0

Hello people! Got a project due tomorrow been at it the whole day still no luck hopping one of you guys could help me out before tomorrow :/

First one...... This is the code

int main() 
{
const double Tax = 0.0825, Rate = 0.15;
int PartNum, Units;
double Price, Sales, DiscountSales, SalesTax, TotalSales;
cout<<"Enter the four-digit part number ----->";
cin>>PartNum;
cout<<"Enter the price in dollars----->";
cin>>Price;
cout<<"Enter the number of units---->";
cin>>Units;



#include <iomanip>
#include <iostream>
using namespace std;



cout<<endl<<"****** Purchase Receipt ******"<<endl;
cout<<"Part #"<<setw(10)<<PartNum<<endl;
cout<<Units<<" @ ";
cout<<"$"<<fixed<<Price<<setw(8)<<"per unit"<<endl;
cout<<"Sales: $"<<DiscountSales<<endl;
cout<<"Tax: $"<<setprecision(4)<<scientific
<<SalesTax<<endl;
cout<<"Discount: $"<<fixed
<<(Sales - DiscountSales)<<endl
<<"Total: $"<<setprecision(2)<<TotalSales;



return 0;
}

I got the first part right when i compile and run
it does what it's supposed to and asks for the specific values
but the second part where it's supposed to calculate and do the receipt
is not working for me... idk what im doing wrong.

The final output is supposed to look like this
****** Purchase Receipt ******
Part #1234
15 @ $11.59 per unit
Sales: $147.77
Tax: $12.19
Discount: $26.08
Total: $159.96

Can someone correct me Please.


The instruction for the second Homework is

Project #1: Exercise the writing of a simple program composed of variables and output statements

This project is an exercise of writing a program in which several variables are declared and values assigned to those variables and values of variables printed out on the screen. This project is designed to put what we have learned in Chapter 2 into practice.

Use Visual C++ to write your program.

Activity 1. Read the following code, which is an incomplete program. Enter the code in the editing window of Visual C++.

#include <iostream>
 
using namespace std;
 
int main()
{
    // Section 1: Declarations that you need to make
 
    // Section 2: Assignments that you need to put here to assign values to variables you have declared in Section 1
 
    // Section 3: Put output statement here to print out the values you have assigned to variables in Sections 2.
 
    return 0;
}

Activity 2. In Section 1 of the previous incomplete program, write declaration statements to declare three variables of type string, and two variables of type char. The string variables should be named make, model, and color. The char variables should be named plateType and classification.

Activity 3. In Section 2, write assignments to assign values to those variables you have declared in Section 1. Figure out the value for each variable. For example, if the output is the one described in Activity 4, the values for the three string variables should be "Ford", "Taurus", and "Red", respectively; and the values for the two char variables should be 'H' and 'L', respectively. You can use other values as you want.

Activity 4. In Section 3, write a series of output statements that print out the values in the variables declared in Sections 1. The values should each appear on a separate line, with a blank line between the string and char values. Each value should be preceded by an identifying message on the same line. An example output is:

The vehicle is manufactured by Ford
Its model is Taurus
Its color is Red

Its platetype is H
Its class is L


i've gotten this far

#include <iostream>
 
using namespace std;
 
int main()
{
	const string Part1 ="make";
	const string part2 ="model";
	const string part3 ="color";

}
return 0;

Absolutely no idea after that i would appreciate any help thanks.

Edited by WaltP: Added CODE Tags -- please use them

2
Contributors
1
Reply
3
Views
6 Years
Discussion Span
Last Post by Taywin
0

Code tag please ... Also, a homework is supposed to be given a long time ago. Please don't tell me that you didn't wait until today to do it...

Anyway, you didn't compute your DiscountSales value before you display it. Isn't it supposed to be DiscountSales = Units*Price*Rate; ?? Also, the SalesTax = Units*Price*Tax; as well... Oh why do you need "TotalSales" variable while you can simply compute it and display as (Units*Price)+SalesTax-DiscountSales; ?

The second part is just to test you how you write a program using what you learn from Chapter 2

This project is an exercise of writing a program in which several variables are declared and values assigned to those variables and values of variables printed out on the screen. This project is designed to put what we have learned in Chapter 2 into practice.

Just follow what it said that you need to declare variable first. Do NOT declare them as const because you are doing it. You need to declare them without initialize them. Then assign values to them. Print them out as whatever you like in the way it said. That's all... I am not sure if this is the field you want to go about if you do not work on your assignment before hand and ask way earlier before it's due. You will get into a lot more trouble if you keep doing this...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.