Switch Case - Flight Miles

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Isaac Bernal

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.

Formula: The formula used is “moneyAmount * 1.25” to create the points.


/*Isaac Bernal
Fundamentals of Programming 1
Professor Lara
10/7/21
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 inputed variable and multiplies it to 1.25 which
equals the amount of points gain by the user.*/

#include <iostream>
#include <string>

using namespace std;

int main() {
int moneyAmount;//variable used for the users money spent

cout << "\t†Knock-Off Gucci Point System Calculater†\n";


cout <<"________________________________________________\n\n";
cout << "♱♱Please Enter Total Amount Spent As Shown Below:♱♱ \n";
cout << "\t\t\t\t\t|$500 |\n";
cout << "\t\t\t\t\t|$1000|\n";
cout << "\t\t\t\t\t|$1500|\n";
cout << "\t\t\t\t\t|$2000|\n";
cout << "\t\t\t\t\t|$3000|\n";
cout << '$';
cin >> moneyAmount;

switch (moneyAmount) //switch statement used to determine the users


points based on input
{
case 500:
cout << "\nYour $500 earned you " << moneyAmount*1.25 << " worth of
points\n" ;
cout <<"___________________________________________";

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;

default: //without loop statement, output ends here


cout << "**ERROR Wrong Choice**";
}

cout << "\n\n\t\t♱Thank You For Shopping With Us♱";

return 0;
}

You might also like