Lab Exercise 1_2 Section COMP 248 solution

$24.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (4 votes)

Question: Write the Java program for the given pseudocode. Using exactly 1 integer constant, 3 integer variables, and 1 Scanner variable make sure to fulfill the following points: 1. Declare 1 constant integer called COST and set it to 25000. 2. Declare 1 integer variable called airmiles. 3. Declare 1 integer variable called flights. 4. Declare 1 integer variable called balance. 5. Declare 1 Scanner variable that will record keyboard inputs. 6. Prompt the user through the console for an integer value for the number of air miles, and store the user’s inputs in the variables airmiles and discount (use the same format and wording as the sample figure below). 7. Record the number of flights the user can redeem in the variable as the result of airmiles / COST. 8. Record the balance of the user’s airmiles in the variable as the results of airmiles % COST. 9. Output in the console a blank line followed by the message You can redeem short haul flights. The balance of your air miles will be . where , and are the values stored in the corresponding variables. The boxes below illustrate how your program should behave and appear. REMEMBER in the output: ◦ is a space and  is a new line. Text in green is user input. Note 1: You are to expect a perfect user who will always enter a positive integer; that is, do not verify the validity of user input. Enter◦the◦balance◦of◦your◦air◦miles?◦76876  You◦can◦redeem◦3◦short◦haul◦flights.◦The◦balance◦of◦your◦air◦miles◦will◦be◦ 1876. Note 2: The use of libraries other than java.util.Scanner is prohibited. Your program must work for any double value entered, not just the one in the sample box above. Note 3: Final thought, remember that your solution is case-sensitive and space-sensitive, fulfill the above instructions carefully and precisely. Reminder: When submitting your solution to the lab system, make sure that if you have a package statement at the top of your .java file it is commented out (has // in front of it) as failing to do so will result in a Compilation Error hence a grade of 0 (restriction of the DOMJudge system).