Question

Conditional Statements in C++ 1. Your company has decided to offer a rewards program for its...

Conditional Statements in C++ 1. Your company has decided to offer a rewards program for its loyal customers. The rewards program offers three levels, Gold(G), Silver(S), and Bronze(B). Discounts on the customer’s sales receipt are provided in the table below along with additional discounts for only the amount of the purchase over $200.00. A maximum discount amount for any purchase is $30.00. Your program should prompt the user for their current reward level and sales receipt amount. Based on the table below, calculate and display the customer’s discount. Reward Level Discount Additional Discount for amount over $200 Gold 12% 3.50% Silver 8% 2.25% Bronze 4% 1.75% 1. Using the parameters above, create a detailed flowchart or pseudocode outlining your program design. Some things to keep in mind while developing your solution:  The majority of program development follows the steps of gathering input, perform calculations, then display output.  Create a separate list of variables and their data types; variables can be added to the list as you continue developing your solution  Start with the basic program flow for a single reward level  Add specifics of the program as you further develop the solution  Add the error checking features  Your program should not contain an excessive amount of repeated code. Review your flowchart to ensure you are designing your code in the most efficient manner.  2. From your flowchart or pseudocode, translate each step into C++ code to develop your code. Keep the following points in mind when creating your program:  Provide your company name in the output.  Your program should perform input validation to make sure only G, S, or B is entered as a reward level and for negative sales amounts. The program should display an appropriate error message and end for invalid input.  Do not use break; (except for switch statement) or continue; statements in your code.  Well-structured programs only have a single return; statement.  Make sure you are using the correct data types and descriptive variable names.  Do not use goto or exit statements in your code.  Be sure to include all three conditional statements (if, switch and condition) statements in your program.  Your program should be user-friendly.  Add a comment to the top of your program that includes your name, the program name, and a description of the program code.  Include descriptive comments throughout your program.  Do not use loops or arrays in your code.  Save the file as Rewards.cpp or main.cpp  For an extra challenge,(but not required) have your program display the additional savings the customer would save if they qualified for the other reward levels.  3. After completing the assignment attach your Rewards lastname.cpp or main.cpp file and flowchart/pseudocode to the Assessment link for grading.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

here is your c++ program : =---------------------->>>>>>>>>>>>

#include<iostream>

using namespace std;

int main(){
double amount = 0.0;//for storing the amount entered by users
const char level[] = {'G','S','B'};//for the reward level
char lev; //for taking the user input for level
double dis = 0,edis = 0;//for storing the discounts of customer

cout<<"Enter the Amount : ";
cin>>amount;
if(amount > 0){
  cout<<"\nEnter Reward Level (G)old ,(B)ronze, (S)ilver ";
  cin>>lev;
  if(lev == level[0]){
   dis = amount * (12.0/100);
   if(amount > 200)
   edis = amount * (3.5/100);
   cout<<"\nCompany Name \t Amount = $"<<amount<<"\tDiscount = $"<<dis<<" Extra Discount = $"<<edis<<" total = $"<<dis+edis;
   
  }else if(lev == level[1]){
   dis = amount * (8.0/100);
   if(amount > 200)
   edis = amount * (2.25/100);
   cout<<"\nCompany Name \t Amount = "<<amount<<"\tDiscount = $"<<dis<<" Extra Discount = $"<<edis<<" total = $"<<dis+edis;
  }else if(lev == level[2]){
   dis = amount * (4.0/100);
   if(amount > 200)
   edis = amount * (1.75/100);
   cout<<"\nCompany Name \t Amount = "<<amount<<"\tDiscount = $"<<dis<<" Extra Discount = $"<<edis<<" total = $"<<dis+edis;
  }else{
   cout<<"\n you entered the wrong reward level";
  }
}else{
  cout<<"\n you entered negative amount ";
}
}

Add a comment
Know the answer?
Add Answer to:
Conditional Statements in C++ 1. Your company has decided to offer a rewards program for its...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • CIST 1305 – Program Design and Development Chapter 4 Assignment #7 [Decisions/If Statements & Loops] (50...

    CIST 1305 – Program Design and Development Chapter 4 Assignment #7 [Decisions/If Statements & Loops] (50 Points) Please do the following exercises: Pastoral College is a small college in the Midwest. Design the pseudo-code for a program that accepts a student name, major field of study, and grade point average. Display a student’s data with the message “Dean’s list” if the student’s grade point average is above 3.5, “Academic probation” if the grade point average is below 2.0, and no...

  • In this program, you will be using C++ programming constructs, such as functions. main.cpp Write a...

    In this program, you will be using C++ programming constructs, such as functions. main.cpp Write a program that asks the user to enter an integer value. Your program will then display that integer back to the user. Your program should include a function called getInteger that requests an integer value from the user and returns that value back to the caller. Your main () function will call the function getInteger and will then display the value returned by that function....

  • Linux & Unix Write a bash program to indent the code in a bash source file....

    Linux & Unix Write a bash program to indent the code in a bash source file. Conditions:     The source file will contain only printing characters, spaces, and newlines. It is not necessary to check for invalid input.     The source file will not contain comments (words beginning with #). Requirements:     Read from standard input, write to standard output.     Code inside while statements should be indented 2 spaces. Be sure your program includes all of the following:    ...

  • Write a C++ program to display workers schedule for a company. To accomplish this (1) Write...

    Write a C++ program to display workers schedule for a company. To accomplish this (1) Write a struct Time with attributes (at least) : hours, minutes and seconds. Add other functions or attributes you need to get the job done (2) Write a class Schedule with attributes : Day of week, start_time, end_time and activity. Schedule should have at least (a) Display to display the schedule (b) Length to return the duration of the schedule (ie end_time - start_time), (c)...

  • Overview Module 3 Assignment 1 features the design of a pseudocode and a Python program that...

    Overview Module 3 Assignment 1 features the design of a pseudocode and a Python program that uses iteration to guess a number from 1 to 10. Each lab asks you to write pseudocode that plans the program’s logic before you write the program in Python and to turn in three things: 1) the pseudocode, 2) a screenshot of the output, and 3) the Python program. Instructions Write pseudocode for a Python program that uses iteration to guess a number from...

  • Conditional statements, loops, reading from file, user defined functions.

    # in C Project objective: Conditional statements, loops, reading from file, user defined functions.**Submit source code (prog3.c) through CanvasOne source code file(unformatted text) will be submittedHere is INCOMPLETE code to get started: prog3.cHere is input.txt file: input.txtThe file name must match the assignmentThe code should be tested and run on a Microsoft compiler before it is uploaded onto CanvasThe code must be submitted on time in order to receive credit (11:59PM on the due date)Late submissions will not be accepted or gradedAll...

  • In Python. Complete the following programs. Begin each program with a comment that includes: • Your...

    In Python. Complete the following programs. Begin each program with a comment that includes: • Your name • The project/program • Brief description of the problem Lab3Pro1 A supervisor in a manufacturing company wishes to display the bonus amount for an employee based on this year's production. Input Output Processing Distribute bonuses as follows: Display the results as follows: Prompt for user input "Enter number of Units produced" Store the amount entered Bonus This year's production bonus will be $nnnnn...

  • C Program Assignment: 2-Add comments to your program to full document it by describing the most...

    C Program Assignment: 2-Add comments to your program to full document it by describing the most important processes. 3-Your variables names should be very friendly. This means that the names should have meaning related to what they are storing. Example: Instead of naming the variable that stores the hours worked for an employee in a variable called ‘x’ you should name it HoursWorked. 5-Submit your .c program (note that I only need your source code and not all files that...

  • Python 3.7 to be used. Just a simple design a program that depends on its own. You should also not need to import anythi...

    Python 3.7 to be used. Just a simple design a program that depends on its own. You should also not need to import anything. No code outside of a function! Median List Traversal and Exception Handling Create a menu-driven program that will accept a collection of non-negative integers from the keyboard, calculate the mean and median values and display those values on the screen. Your menu should have 6 options 50% below 50% above Add a number to the list/array...

  • CIS 22A C++ Project Exam Statistics Here is what your program will do: first it welcomes...

    CIS 22A C++ Project Exam Statistics Here is what your program will do: first it welcomes the user and displays the purpose of the program. It then prompts the user to enter the name of an input file (such as scores.txt). Assume the file contains the scores of the final exams; each score is preceded by a 5 characters student id. Create the input file: copy and paste the following data into a new text file named scores.txt DH232 89...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT