Question
Write a C++ program that calculates the purchase for video game sales. New games are $9.95 and all others $7.95. If a customer buys more
Write a C++ program that calculates the purchase for video game sales. New games are $9.95 and all others $7.95. If a customer buys more than 3 video games, the fourth one is free. Ask the user how many video games the customer is purchasing. Ask the user whether the video game is a new release. Then display the total of the purchase.
I think answer is :
#include
using namespace std;
int main() { int games, type; double cost = 0; cout << "Enter the amount of video games bought : " << end1; cin >> games; for(int i = 0; i < games;i++){ if ((i+1) % 4==0) cout << "Every 4th game is free of cost" << end1; else{ cout <<"1.New Game 2. Other: Enter type of game: " end1; cin >> type; if (type =1) cost = cost + 9.95; else cost = cost + 7.95; } } cout <<"Total cost for"<<"games"<<"games is $"<< cost; return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started