By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,857 Members | 1,835 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,857 IT Pros & Developers. It's quick & easy.

I Need Help Asap!!!!! Please Help Me

P: 2
I need help with my problem I am stuck and I don't know what to do!!! The problem is:
This program calculates the charges for DVD rentals where current releases cost $3.5 and all others cast $2.50. If a customer rents several DVDs, every third one of each type is free. You need to tell the user what their total cost of rental whould be based on the amount of Dvds the user enters(decides to rent).

Based on the following input:
3 current 3 others...total cost is 12.00
2 current 2 others...total cost is 12.00
4 current 4 others.....totak cost is 18.00

I started to work it out but now i'm stuck and I don't know how to calculate the formula for the current releases and old dvds with the 3rd one free. Also I don't know how to calculate the 3rd dvd of every kind. This is what I have so far

#include<iostream>
using namespace std;
int main()
{
double total_cost;
int dvds;
new_dvds=3.50;
old_dvds=2.50;
int user_choice;

cout<<"How many DVD's would you like to rent"<<endl;
cin>>dvds;
for(user_choice=dvds;user_choice>=3;user_choice++)
{
if((dvds<3)&&(dvds=old_dvds))
{
total_cost=(2.50*dvds);
}
else if((dvds<3)&&(dvds=new_dvds))
{
total_cost=(3.50*dvds);
}
if((dvds>=3)&&(dvds=new_dvds))
{
user_choice=user_choice+1;
total_cost=3.50*
}
else if((dvds>=3)&&(dvds=old_dvds))
{
user_choice=user_choice+1;
total_cost=2.50*
}



cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);

cout<<"Your Total cost is"<<total_cost<<endl;

system("pause");
return 0;
}

please help me out its due 11:59 to night. I need some free advice I can't afford to pay. thank you
Oct 6 '06 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.