Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a Java program for these two questions s ucint to use 11. Write a Java program using while loop that determine whether inon prompt
Write a Java program for these two questions
s ucint to use 11. Write a Java program using while loop that determine whether inon prompt the user to input an even number. If it is number "Good bye!" messages, otherwise, print "Wrong input data is an even number. Your program wil an even number, your program will terminate with "Correcti" and , then ask user to type a number again canner Sample log of execution: Type an even number: 3 Wrong! Type an even number: 4 Correct! Good bye! veturn 12. Write a Java program that calculates sales price. Your program will prompt the user for information about two parameters: real number of price (data type: double) and four digits of membership ID(data type: String). One method should receive the parameters and return how much money to pay to buy the good. The customer should receive discount of 10% from the original price if membership ID starts with A and receive discount of 5% f starts with 'B'. For example, the call pay(100.0, "A301") should return 90.0. (eg: 100 (100 0.1)-90.0). If ID starts with neither Anora 0% discount rate s applied. Assume every input data is valid price is double, ID s 4-digit string and this program does not run repeatedly (NO while loop is required). membership ID String the Sample log of execution: Price? 1000 ID? A301 You pay:90.0 Price? 100.0 ID? C500 You pay: 100.0 Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started