The New Wave Computer Company sells its product, the NW-PC for $675. In addition, they sell memory expansion cards for $69.95, disk drives for $198.50, and software for $34.98 each. Given the number of memory cards, disk drives, and software packages desired by a customer purchasing a NW-PC, print out a bill of sale that appears as follows:

ITEM                        cost
1    NW-PC                  $675.00
2    MEMORY CARD            $139.90 
1    DISK DRIVE             $198.50
4    SOFTWARE               $139.92

TOTAL                       $1153.32

This is what I have so far but how do I promp the computer to show the cin inut value of each item like the ones on the left (1,2,1,4 etc)...I say my program is roughly 90% complete but im stuck on the last little bit. I also dont understand why the code text is not showing up in the different colors that its supposed to (red, orange, green etc) for simplicity purposes. I copied and pasted this from the main.cpp file from off of Xcode. sorry for the inconvenience and thnx for the response

#include <iostream>
#include <cmath>
#include <fstream>
#include <iomanip>

using namespace std;

const float NW_PC = 675;
const float MEMORY_CARD = 139.90;
const float DISC_DRIVE = 198.50;
const float SOFTWARE = 139.92;

int main () 
    double PC;
    double mem_CARD;
    double disc_DRIVE;
    double soft_WARE;
    double bill_TOTAL;
    //double input;

    cout << setw(5)<<fixed<<showpoint;

    cout <<"Enter the number of PC needed :" <<endl;
    cin >> PC;

    cout <<"Enter the number of Memory Card needed :" <<endl;
    cin >> mem_CARD;

    cout <<"Enter the number of Disc Drive needed :" <<endl;
    cin >> disc_DRIVE;

    cout <<"Enter the number of Software needed :" <<endl;
    cin >> soft_WARE;

    bill_TOTAL = ((PC*NW_PC) + (mem_CARD + MEMORY_CARD) + (disc_DRIVE + DISC_DRIVE) + (soft_WARE + SOFTWARE));

                  cout << bill_TOTAL;

    return 0;

5 Years
Discussion Span
Last Post by mbasit
  1. PC, mem_CARD, soft_WARE, and disk_DRIVE should be an int, not double because you can't by a fraction of those items, whole numbers only. Use the data type that is appropriate for the thing you want it to represent.


You need to multiply those numbers, not add them. * multiplies

I also dont understand why the code text is not showing up in the different colors that its supposed

Each editor has its own way to color-code c++ text, don't expect all editors to look like Turbo C

Edited by Ancient Dragon


thanx for the help, besides the basic confusion between the multiple sign and plus sign i think i got it figured out, program has to read from file and output to file, I used this program above as a template and changed the input from cin>> input to ins>>input and it works. thanx for the help.

This question has already been answered. 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.