4 java questions 2
#1 Write a java program which calculates the area of either a Triangle or a Rectangle. Use Scanner to take an input field to tell you if the area to be calculated is for a Triangle or is for a Rectangle. Depending on that input – the program must call either the Triangle method or the Rectangle method. Each of those methods must receive 2 input fields from the user – one for base and one for height in order to calculate the area and then to print that area and the height and base from inside the method.
#2 Write a java program making use of methods that finds the smallest of any three numbers that the user inputs. You must use JoptionPane to input the three numbers. A first method must be called and used to develop logic to find the smallest of the three numbers. A second method must be used to print out that smallest number found.
#3 Write a java program which uses methods for calculating the sum of any 5 nonzero integer digits that are input. The program must use scanner for input of the 5 digits. Two Methods must be used, one for calculating the sum of the 5 digits & the other for printing the sum of the digits. [remember a digit is a single character 1 thru 9]
#4 Write a java program to calculate employee pay using methods. There must be an overtime pay method and a straight pay method and a print method. Using either scanner or JoptionPane, input the employee number, the hours worked, and the hourly pay for an employee. If the employee worked over 40 hours, call the overtime method, if not call the straight time method. Calculate the pay amount in one of the 2 methods. Call a third method to print the employee number and the pay amount.