Question: Write a program in which you have 3 function. (Mean you have to write 3 function with one main and one project), First Function name

Write a program in which you have 3 function. (Mean you have to write 3 function with one main and one project), First Function name should be Int_User_Input. This function should take the integer input from user and return it. Second Function name should be Float_User_Input and this function should take the float input from user and return it. Third Function name should be User_Display, This function should display the inputs we take in functions Int_User_Input and Float_User_Input. 



When Program start It should ask the user if you want to enter float input or integer input, if user selects int input then Int_User_Input should run, If use select float then function Float_User_Input should run.



Hint:



For second part (When Program start It should ask the user if you want to enter float input or integer input) you will write this code in main with if condition. 



For example:

class S

{

public static void main(String[] args) 

Scanner s = new Scanner(System.in);


System.out.println("Enter 1 for Integer input or 2 for Float Input"); 

int input = s.nextInt(); // Read user input


if(input = 1)

{

Int_User_Input()

}

else

{

Float_User_Input()

}

// TODO Code here

}

static void Int_User_Input() 

{

//TODO Code here

}

static void Float_User_Input () 


{

//TODO Code here

}

static void User_Display()

{

//TODO Code here

}

}

Step by Step Solution

3.45 Rating (158 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

import javautilScanner public class UserInputProgram public static void mainStr... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!