Hey guys,
I am having issues with a C++ homework I am doing. I would like some help please.
Create your program, zip up the main.cpp file ONLY and load it to Mimir - make sure your cpp file is named main.cpp!.
You have a book club that awards discounts to the purchasers of books based on the number of books they purchase. Discounts are awarded as follows.
Points Books Purchased Points Awarded 0 0 1 1% 2 2% 3 3% 4+ 5%
Your program should ask the user for the number of books purchased,
Then for a given book: Advanced C++ Programming by Gaddis, Store Price $39.95
Display the sale as:
Name: The actual name of the book from above
Store Cost:
Discount awarded: as a percent and as a
Final Cost:
This is what I have and I know I am doing something super wrong:
#include<iostream>
using namespace std;
int main()
{
int books, points;
cout << "Enter the number of books purchased this month: ";
cin >> books;
if(books == 0)
{
points = 0;
cout << "You have earned points: " << points <<endl;
}
if(books == 1)
{
points = 1;
cout << "You have earned points : " << points <<endl;
}
if(books == 2)
{
points = 2;
cout << "You have earned points: " << points <<endl;
}
if(books == 3)
{
points = 3;
cout << "You have earned points: " << points <<endl;
}
if(books >= 4)
{
points = 4;
cout << "You have earned points: " << points <<endl;
}
else
{
if(books < 0)
cout << "Number of books cannot be negative!! \n\n";
}
return 0;
}
Can somebody help me figure this out please. I have posted a link from imgur that shows what the homework is supposed to be.
https://imgur.com/a/7VfJkMk