Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

import javautilScanner public class UserInputProgram public static void mainStr... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Numerical Methods With Chemical Engineering Applications

Authors: Kevin D. Dorfman, Prodromos Daoutidis

1st Edition

1107135117, 978-1107135116

More Books

Students also viewed these Programming questions