Question: Objective To build a complete working Java program to apply variations on the selection control structure and basic error - testing. Overview & Instructions Write
Objective
To build a complete working Java program to apply variations on the selection control structure and basic
errortesting.
Overview & Instructions
Write a program that manages the rewards program for a credit card company.
Your program will prompt the user via dialog boxes for four data items. First, prompt for the following
three monetary decimal values related to monthly purchases made:
Electronics Computers phones, tablets, etc.
Travel Gasoline air travel, etc.
General purchases
Next, prompt for one more single character data element:
B or b for business
P or p for personal
The initial rewards to be returned to the customer will be based on the following:
Type Reward Level
Electronics
Travel
All General
This initial base reward amount to return will be these simple percentages multiplied by the respective
purchase amounts.
Next, offer all personal customers a volume reward based on the total monthly purchases using the
following scheme:
If total purchase amount is Additional reward is
Over $ but under $
$ to $
above $
For business customers, travel and electronic purchases are being promoted so the following scheme
defines the volume reward:
If sum of travel and electronic
purchases is
Additional reward is
Over $ but under $
$ to $
above $ but not over $
Over $
Note that these additional volume awards are applied to the total monthly purchases of all categories and
are then added to the initial rewards calculated by category.
Finally, a "random drawing" is to be included for personal customers only. Every th customer will
receive a $ reward. Your program is only processing one customer at a time, so to simulate this
"drawing" a random number generator action must be included in your code to check for "one chance in
five". If this chance selection matches, add $ to the total reward.
Your program should include the following errorchecking features:
Purchase amounts electronics travel, and general must all be zero or above
Customer code must be only B or P
For input validation, work to utilize if and "else" actions to bypass calculations and output for invalid
user input. Avoid use of multiple "exit points" within your program ie using System.exit
Your output should be a clear, organized summary that includes the amount purchased in each category
ie the input values the base reward amount, the additional reward total, the reward received from the
random drawing but only if received and final total reward. It should be formatted to dollar amounts
labels and headings as appropriate.
Finally, a programming note for String usage:
Instead of if aString B use if aStringequalsB
To convert a String to a char, use: aChar aString.charAt;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
