A credit card company awards monthly reward points (integer type) based on the type of membership a customer has and the amount they charge to their card that month. The user will enter the membership type and purchase amount, then determine the appropriate number of reward points. Use a pretest loop to allow the user to enter data until they input 0 for the purchase amount.
Do all of your output in main(). Make it look like this. Don’t forget your underlines won’t be immediately underneath.
Use methods for the following:
getPurchaseAmt()
Get the monthly purchase amount from the user. Include an error-trap around this input value so the user will have to enter a positive number (0r 0 to end the loop). Return the purchase amount.
displayMenu()
Display a menu of the membership types for the user to choose from, as follows:
Membership Types:
- Premium
- Plus
- Standard
Enter choice (1, 2, or 3):
This method only displays. There is nothing to return, so it will be a void method. You will call this method from getType().
getType()
Call the displayMenu() method and get the membership type from the user. Include an error-trap around the menu and choice so the program will not continue until the user enters a valid choice. Return the choice.
calcPoints()
Premium members receive 3 reward points for every 100 dollars they spend, Plus members receive 2 reward points for every hundred dollars they spend, and Standard members receive 1 reward point for every 100 dollars they spend. (Hint: Integer division and type casting as int will come in handy for this). Return the number of reward points.
Trending nowThis is a popular solution!
Step by stepSolved in 5 steps with 3 images
- Your task: The maximum of the absolute values. For instance, if the numbers entered are [1, -7, -1, -3, 6, -2, 0], then the printed result must be 7.arrow_forwardWhile Loop (PLEASE COMPLETE IN JAVA)Instructions Write a program that finds out the perimeter of a multi-sided shape. Perimeter of a multi-sided shape can be found by adding all of the sides together.The user should enter each number at the command prompt. The user will indicate that he or she isfinished entering the number by entering the number -1.Example:This program will sum a series of numbers.Enter the next number (enter -1 when finished)> 2Enter the next number (enter -1 when finished)> 2Enter the next number (enter -1 when finished)> 1Enter the next number (enter -1 when finished)> 1Enter the next number (enter -1 when finished)> -1The sum of your numbers is 6arrow_forwardIn various applications, you are often asked to compute the mean and standard deviation of data. The mean is simply the average of the numbers. The standard deviation is a statistic that tells you how tightly all the various data are clustered around the mean in a set of data. For example, what is the average age of the students in a class? How close are the ages? If all the students are the same age, the deviation is 0. Write a program that prompts the user to enter any number of values into a double array, and then calculates and displays the mean and standard deviations of these numbers using the following formulas: (z - mean) z+z3+ *** +zn deviation = mean = n-1 Required Methods You must write your program so that the following methods are defined/implemented and used (called): • /* Compute the deviation of double values */ public static double deviation (double[] x) • /* Compute the mean of an array of double values */ public static double mean (double[] x) Sample Run (user input…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education