wrote a program; please review/comment
Will this program run?
Any suggestions?
Problem: write a c++ program that prompts the user for a cost per item, number of items purchased, and a discount rate. The program should then calculate and print the total cost, tax due, and amount due.
My program and algorithm:
//prompt the user for a cost per item
//prompt the user for number of items purchased
//prompt the user for a discount rate
//calculate the total cost, tax due, and amount due.
//print the total cost, tax due and amount due
#include <iostream.h>
int main()
{
const float salestax = 0.06;
float numberitems, costperitem, discountrate, totalcost, taxdue, amountdue, taxrate, newtotal;
totalcost = numbitems * costperitem;
newtotal = totalcost - (discountrate * totalcost)
taxdue = newtotal * taxrate
amountdue = newtotal + taxdue
cout<<"enter cost per item";
cin>> costperitem
cout<<"enter number of items";
cin>> numberitems
cout<<"enter discount rate";
cin>> discountrate
cout<< “Your amount due is”<< amountdue
return 0;
}