Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

INSTRUCTIONS 1. Declare class-level named constants for the bonus miles and bonus segments that customers receive if signed up for a promotion. Prompt the user

image text in transcribed
image text in transcribed
INSTRUCTIONS 1. Declare class-level named constants for the bonus miles and bonus segments that customers receive if signed up for a promotion. Prompt the user to enter whether the customer is participating in the promotion, and store the value as a String (use Scanner's nextLine) method). 2. 3. Prompt the user to enter mileage flown, and store the value as an integer 4. Prompt the user to enter segment count, and store the value as a integer 5. Determine if the customer mileage and segment count should be increased by the bonus amounts. If yes, add the bonus to the customer data. To make this decision, take the first character from the participation String and evaluate it for being equal to 'Y" or 'y, which means yes. All other characters signify No participation. Use a "simple" if statement for this step o Hint: you can do this by using various String methods for equality and case conversions. See String methods for details on the appropriate methods. Hint: you can also do this by using a String method charAt (index) and using a compound boolean expression to check for both cases. See String methods for details on charAt. Hint: do not usefor Strings. You need to preserve the pre-bonus data for output, so you need new variables for the bonused data. o Hint: Be mindful of variable scope rules. Make sure variables are visible where you need them to be, and that they contain valid values regardless of the outcome of the if statement. 6. Determine the status level for which the customer is eligible, based on the Table 1. Use an "else- if" pattern for this step . Following the sample output below, report the following information, in this order: The total mileage flown without bonus o o The total mileage flown with bonus (if no bonus, then same as above) o The count of segments flown without bonus The count of segments flown with bonus (if no bonus, then same as above) The customer status level o o 8. When printing output, make sure that you separate the logic from the output, i.e., you should have only one System.out.printin statement that prints the customer's status. This print statement, along with the print statements that display the mileage and segment counts should be outside and below all if/else logic. SAMPLE OUTPUT zun Participates in promotion? [Yles or tyles Enter customer mileage: 165000 Enter customer segments 80 Total mileage: 165000 Total mileage with bonus: 165000 Count of segments flown: 80 Count of segments with bonus: 80 The customer. tatus is: platinum BUILD SUCCESSFUL (total time: B seconds) zun Participates in promotion? [Yjes o yles Enter customer nileage 165000 Enter customer segments 72 Total mileage: 165000 Total mileage with bonus: 165000 Count of segments flown: 72 Count of segments with bonus: 72 The customer's tatu is: Gold BUILD SUCCESSFUL (total time: 21 seconds) zun Participates in promotion? Yles o yles Enter customer nileage 170000 Enter customer segments 65 Total mileage: 170o00 Total mileage with bonus: 195000 Count of segments flown: 65 Count f egnents with bonus: 75 The customer's tatu is: Platinum BUILD SUCCESSFUL (otal time: 20 seconds)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions