Problems with my New Car Price Calculator code!

I am in an online introduction to programming class and my instructor isnt helping me at all with my problems! This program has a main module that utilizes submodules to complete the process. I had a pseudocode format of the correct code but my instructor didnt teach us how to change it to c++ code format. I went through all sorts of different tutorials to get some sort of grasp on it but with no reults. Please if anyone can help me with my code!

This problem has BasePrice, EngineChoice, TrimChoice, and RadioChoice as inputs and SellingPrice as the only output.
My program must 1)input the base price of car, 2)Process the various option choices to compute additional costs, 3) Total all the costs, and 4) Display the final selling price for the car and choices that you have made.

If it is at all possible try to explain what I was doing wrong or explain what new steps you added! I know this is a lot but Im desperate and my professor doesnt help at all!



// scott-assignment 3.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"


int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}


#include <iostream>
using namespace std;

void Compute_Engine_Cost();
void Compute_Interior_Trim_Cost();
void Compute_Radio_Cost();
void Display_Selling_Price();

float BasePrice; // the base price of vehicle
float EngineCost; // the cost of the different kinds of engines
float TrimCost; // the cost of the different kinds of trims
float RadioCost; // the cost of the different kinds of radios
int main()
{

cout << "Enter the base price of your vehicle: ";
cin >> BasePrice;
Compute_Engine_Cost();
Compute_Interior_Trim_Cost();
Compute_Radio_Cost();
Display_Selling_Price();

return 0;
}



void Compute_Engine_Cost()
{
// asking which kind of engine (submodule)
char EnginePrice;

cout << "S - 6 cylinder engine"
<< "E - 8 cylinder engine"
<< "D - Diesel engine"
<< "What is your selection? ";
cin >> EnginePrice;


//case statement of choices
switch (EngineCost)
{
case 'S': EngineCost= 150 ; break;
case 'E': EngineCost= 475 ; break;
case 'D': EngineCost= 750 ; break;
}
}


void Compute_Interior_Trim_Cost() //choice of kind of trim (submodule)
char TrimPrice

cout << "V - Vynyl interior trim"
<< "C - Cloth interior trim"
<< "L - Leather interior trim"
<< "What is your selection? ";
cin >> TrimPrice;

//Case statement of trim choice
switch (TrimCost)
{
case 'V': TrimCost= 50 ; break;
case 'C': TrimCost= 225 ; break;
case 'L': TrimCost= 800 ; break;
}
}


void Compute_Radio_Cost()
{
char R;
char O;
//choice of kind of radio (submodule)
char RadioCost

cout << "R - AM/FM Radio"
<< "O - CD/DVD"
<< "What is your selection?";
cin >> RadioCost;


//if-else statement of radio choice
if (RadioCost == R) RadioCost = 100;
else RadioCost = 400;
}
void Display_Selling_Price()
{
// selling price which includes shipping, dealer charges, and selling price
float ShippingCharge;
float DealerCharge;
float SellingPrice;



//calclations (submodule)
ShippingCharge = 500;
DealerCharge = 175;
SellingPrice= BasePrice + EngineCost + TrimCost + RadioCost +ShippingCharge + DealerCharge;

cout << "The total selling price for your vehicle is $ " + SellingPrice;

}



Thank you to anyone who responds!

1. this:
1
2
3
4
5
6
7
#include "stdafx.h"


int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}

shouldn't be in your code

2. what are the errors/problems you're having?

3. use code tags, they're much nicer than bolded words
In Compute_Engine_Cost you switch Engine cost, but it doesn't even have a value assigned to it yet. You should be switching EnginePrice instead since it is the one which can be 'S', 'E' or 'D'.
Compute_Interior_Trim_Cost is lacking a {. Also, it has the same problem as Compute_Engine_Cost.
Problem with Compute_Radio_Cost is that you have a local variable with the same name as a global variable. Also, chars R and O do NOT have values 'R' and 'O' assigned to them automatically. You don't even need them. Write if (RadioPrice == 'R') RadioCost = 100; ....
Your naming is not great. Logically variable RadioPrice should mean the same as RadioCost, but instead it doesn't. You might want to rename it to RadioType or RadioChoice, etc. for clarity.
Also, you have two int main()s. Delete the first one.
Thank you guys, I figured it out like a couple of minutes after I posted this!
Topic archived. No new replies allowed.