Question: Program #1 Write a Java application, called EnglishToMetricConverter.java. The program will provide a menu of options to the user. The user will enter the choice
Program #1
Write a Java application, called EnglishToMetricConverter.java. The program will provide a menu of options to the user. The user will enter the choice of operation by entering a single character (as shown in the sample runs). Based on users input, the program will ask for another input, perform the conversion and print the result. If the user enters a choice other than A, B, C, D, the program will generate an error message (see sample run #5). Sample Run #1: Welcome to English-to-metric Converter Program A: Inches -> Centimeters B: Pounds -> Kilograms C: Miles -> Kilometers D: Gallons -> Liters Your choice: A Enter the number of inches: 20 20.0 inches is equal to 50.8 centimeters. Sample Run #2: Welcome to English-to-metric Converter Program A: Inches -> Centimeters B: Pounds -> Kilograms C: Miles -> Kilometers D: Gallons -> Liters Your choice: B Enter the number of pounds: 160 160.0 pounds is equal to 72.57472 kilograms. Sample Run #3: Welcome to English-to-metric Converter Program A: Inches -> Centimeters B: Pounds -> Kilograms C: Miles -> Kilometers D: Gallons -> Liters Your choice: C Enter the number of miles: 50 50.0 miles is equal to 80.467 kilometers. Sample Run #4: Welcome to English-to-metric Converter Program A: Inches -> Centimeters B: Pounds -> Kilograms C: Miles -> Kilometers D: Gallons -> Liters Your choice: D Enter the number of gallons: 5 5.0 gallons is equal to 18.92705 liters. Sample Run #5: Welcome to English-to-metric Converter Program A: Inches -> Centimeters B: Pounds -> Kilograms C: Miles -> Kilometers D: Gallons -> Liters Your choice: E You entered an invalid input! Program #2
Write a Java program, called TicketGenerator.java, that will accept as input a one-character designator (C, T, or S) followed by the number of minutes a vehicle has been in the lot. The program should then compute the appropriate charge and print a ticket to for the customer to the console. Any part of hour is to be counted as a full hour. Assume that the user enters valid input. Use the following parking rates: Cars: First 2 hours: No Charge Next 3 hours: $10/hour Next 10 hours: $30/hour Trucks: First 1 hour: No Charge Next 2 hours: $20/hour Next 12 hours: $50/hour Senior Citizens: No Charge Important Note: Please note that sample run(s) are not provided. Feel free to design the ticket console output as you wish. Please Make sure you print the total charge and number of hours the vehicle stayed in the lot in the ticket.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
