Professional Documents
Culture Documents
Switch Case - Flight Miles
Switch Case - Flight Miles
Switch Case - Flight Miles
Fundamentals of Programming 1
Professor Lara
10/7/21
Analysis
This program is a practice on the switch commands. The code is for a point system of a
store based on certain amounts of money spent in said store. The code enters the
inputted variable and multiplies it to 1.25 which equals the number of points gained by
the user.
Variables: There is only one variable used in this program. The variable used in this
program is called “moneyAmount”. This variable is inputted by the user and the options
for this input are 500, 1000, 1500, 2000, and 3000.
Data Validations: The program will use the input from the user to calculate points set by
the store based on how much the user spends.
#include <iostream>
#include <string>
int main() {
int moneyAmount;//variable used for the users money spent
break;
case 1000:
cout << "\nYour $1000 earned you " << moneyAmount*1.25 << " worth of
points\n" ;
cout <<"___________________________________________";
break;
case 1500:
cout << "\nYour $1500 earned you " << moneyAmount*1.25 << " worth of
points\n" ;
cout <<"___________________________________________";
break;
case 2000:
cout << "\nYour $2000 earned you " << moneyAmount*1.25 << " worth of
points\n" ;
cout <<"___________________________________________";
break;
case 3000:
cout << "\nYour $3000 earned you " << moneyAmount*1.25 << " worth of
points\n" ;
cout <<"___________________________________________";
break;
return 0;
}