I just started my assignment for the group and I need help with these.
The question is based on here: http://sdrv.ms/16292hI

I'm new to this, but I've only learned up to 'Chapter 10: Decision Making'.

It's a lot of coding for this assignment and it's incomplete:

// Stationery Ordering System.cpp : How much sales Writers Depot get for selling stationery.
//

/*
ICT1101 ASSIGNMENT 2 - GROUP
C++ code
*/

#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

int main ()
{
    // output variables

    float SaleBP, SaleNB, SaleFD, SalePL;           // Sale amount of Blue pen 1.0 point, One inch thick notebook, Two-pocket plastic folder, and 200-pages blank planner respectively.
    float PaidBP, PaidNB, PaidFD, PaidPL;           // Paid amount of Blue pen 1.0 point, One inch thick notebook, Two-pocket plastic folder, and 200-pages blank planner respectively.
    float UnpaidBP, UnpaidNB, UnpaidFD, UnpaidPL;   // Unpaid amount of Blue pen 1.0 point, One inch thick notebook, Two-pocket plastic folder, and 200-pages blank planner respectively.
    float TotalPaid;    //  Total paid amount.
    float TotalUnpaid;  //  Total unpaid amount.
    float NetProfit;    //  Net profit gained.

    // process variables
    float Profit;       // Profit margin of an item.
    float Discount;     // Discount per order.

    // input variables
    char Option;        // Choosing an option.
    char ItemOption;    // Chossing an item.
    int BluePen;        // Quantity of Blue pen 1.0 point.
    int Notebook;       // Quantity of One inch thick notebook.
    int Folder;         // Quantity of Two-pocket plastic folder.
    int Planner;        // Quantity of 200-pages blank planner.

    // input
    cout<< "Welcome to Writers Depot's Stationery Ordering System. Choose an option: \n" ;
    cout<< "a.    Enter order details \n" ;
    cout<< "b.    Display monthly report \n" ;
    cout<< "c.    Exit the system \n" ;

    cout<< "Your option: " ;
    cin>> Option ;

    if (Option == 'a')
    {
        cout<< "------------------------MENU------------------------ \n" ;
        cout<< "  ITEM                          COST PER UNIT \n" ;
        cout<< "a.    Blue pen 1.0 point                  RM 0.20 \n" ;
        cout<< "b.    One inch thick notebook             RM 2.50 \n" ;
        cout<< "c.    Two-pocket plastic folder           RM 0.50 \n" ;
        cout<< "d.    200-pages blank planner             RM 2.50 \n" ;

        cout<< "Choose an item: " ;
        cin>> ItemOption ;

        if (ItemOption == 'a')
        {
            // Enter quantity of Blue pen 1.0 point

            cout<< "You choose to buy Blue pen 1.0 point. \n" ;
            cout<< "How many units you want to buy? \n" ;
            cout<< "Quantity: " ;
            cin>> BluePen ;


        }

        if (ItemOption == 'b')
        {
            // Enter quantity of One inch thick notebook

            cout<< "You choose to buy One inch thick notebook. \n" ;
            cout<< "How many units you want to buy? \n" ;
            cout<< "Quantity: " ;
            cin>> Notebook ;


        }

        if (ItemOption == 'c')
        {
            // Enter quantity of Two-pocket plastic folder

            cout<< "You choose to buy Two-pocket plastic folder. \n" ;
            cout<< "How many units you want to buy? \n" ;
            cout<< "Quantity: " ;
            cin>> Folder ;


        }

        if (ItemOption == 'd')
        {
            // Enter quantity of 200-pages blank planner

            cout<< "You choose to buy 200-pages blank planner. \n" ;
            cout<< "How many units you want to buy? \n" ;
            cout<< "Quantity: " ;
            cin>> Planner ;

        }

        else
        {
            cout<< "Sorry, no item option in the system. Please select again."<<endl;
        }
    }

    if (Option == 'b')
    {
        // process
        TotalPaid = PaidBP + PaidNB + PaidFD + PaidPL ; // Total paid amount.
        TotalUnpaid = UnpaidBP + UnpaidNB + UnpaidFD + UnpaidPL ; // Total unpaid amount.


        // output
        cout<< "a.    Total quantity ordered for each item:" <<endl;
        cout<< "  Blue pen 1.0 point          : "<< BluePen <<endl;
        cout<< "  One inch thick notebook     : "<< Notebook <<endl;
        cout<< "  Two-pocket plastic folder   : "<< Folder <<endl;
        cout<< "  200-pages blank planner     : "<< Planner <<endl<<endl;


        cout<< "b.    Sale amount for each item:" <<endl;
        cout<< "  Blue pen 1.0 point          : "<< SaleBP <<endl;
        cout<< "  One inch thick notebook     : "<< SaleNB <<endl;
        cout<< "  Two-pocket plastic folder   : "<< SaleFD <<endl;
        cout<< "  200-pages blank planner     : "<< SalePL <<endl<<endl;


        cout<< "c.    Paid amount for each item:" <<endl;
        cout<< "  Blue pen 1.0 point          : "<< PaidBP <<endl;
        cout<< "  One inch thick notebook     : "<< PaidNB <<endl;
        cout<< "  Two-pocket plastic folder   : "<< PaidFD <<endl;
        cout<< "  200-pages blank planner     : "<< PaidPL <<endl<<endl;


        cout<< "d.    Unpaid amount for each item:" <<endl;
        cout<< "  Blue pen 1.0 point          : "<< UnpaidBP <<endl;
        cout<< "  One inch thick notebook     : "<< UnpaidNB <<endl;
        cout<< "  Two-pocket plastic folder   : "<< UnpaidFD <<endl;
        cout<< "  200-pages blank planner     : "<< UnpaidPL <<endl<<endl;      


        cout<< "e.    Total paid amount:"<< TotalPaid <<endl;
        cout<< "f.    Total unpaid amount:"<< TotalUnpaid <<endl;
        cout<< "g.    Net profit gained:"<< NetProfit <<endl;
    }

    if (Option == 'c')
    {
        system("pause");
    }

    else
    {
        system("pause");
    }
    return 0;
}

And also, it says that the items are only ordered in the multiple of 100. If is not multiple of 100, the user has to re-input.

Recommended Answers

All 3 Replies

We're not going to simply do your homework for you; you need to ask questions, or tell us what error or warning you are getting, or ask about how to do something that you don't understand, or ask why something is happening that you think shouldn't happen, and so on.

And also, it says that the items are only ordered in the multiple of 100. If is not multiple of 100, the user has to re-input.

A simple way to do this is to use the modulus function %.

My updated code. 16 errors. What's wrong?

// Stationery Ordering System.cpp : How much sales Writers Depot get for selling stationery.
//

/*
ICT1101 ASSIGNMENT 2 - GROUP
C++ code
*/


#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

int main ()
{
    // output variables

    float SaleBP, SaleNB, SaleFD, SalePL;           // Sale amount of Blue pen 1.0 point, One inch thick notebook, Two-pocket plastic folder, and 200-pages blank planner respectively.
    float PaidBP, PaidNB, PaidFD, PaidPL;           // Paid amount of Blue pen 1.0 point, One inch thick notebook, Two-pocket plastic folder, and 200-pages blank planner respectively.
    float UnpaidBP, UnpaidNB, UnpaidFD, UnpaidPL;   // Unpaid amount of Blue pen 1.0 point, One inch thick notebook, Two-pocket plastic folder, and 200-pages blank planner respectively.
    float TotalPaid;    //  Total paid amount.
    float TotalUnpaid;  //  Total unpaid amount.
    float NetProfit;    //  Net profit gained.

        // When ordering
        float TotalSales; // Total sales of all items ordered.

    // process variables
    float Discount;     // Discount per order.
    float npBluePen, npNotebook, npFolder, npPlanner;   // Net profit of Blue pen 1.0 point, One inch thick notebook, Two-pocket plastic folder, and 200-pages blank planner respectively.

    // input variables
    char Option;        // Choosing an option.
    char ItemOption;    // Chossing an item.
    int BluePen;        // Quantity of Blue pen 1.0 point.
    int Notebook;       // Quantity of One inch thick notebook.
    int Folder;         // Quantity of Two-pocket plastic folder.
    int Planner;        // Quantity of 200-pages blank planner.

    // input
    cout<< "Welcome to Writers Depot's Stationery Ordering System. Choose an option: \n" ;
    cout<< "a.    Enter order details \n" ;
    cout<< "b.    Display monthly report \n" ;
    cout<< "c.    Exit the system \n" ;

    cout<< "Your option: " ;
    cin>> Option ;

    switch (Option)
    {
    case 'a': case 'A':
        // Ordering menu
        cout<< "------------------------MENU------------------------ \n" ;
        cout<< "  ITEM                          COST PER UNIT \n" ;
        cout<< "a.    Blue pen 1.0 point                  RM 0.20 \n" ;
        cout<< "b.    One inch thick notebook                 RM 2.50 \n" ;
        cout<< "c.    Two-pocket plastic folder               RM 0.50 \n" ;
        cout<< "d.    200-pages blank planner                 RM 2.50 \n" ;
        cout<<endl;
        cout<< "Choose 'e' to calculate the total price of all the items. \n" ;

        cout<< "Choose an item: " ;
        cin>> ItemOption ;

        switch (ItemOption)
        {
        case 'a': case 'A':
            // Enter quantity of Blue pen 1.0 point

            cout<< "You choose to buy Blue pen 1.0 point. \n" ;
            cout<< "How many units you want to buy? \n" ;
            cout<< "Quantity: " ;
            cin>> BluePen ;

            if (1 <= BluePen && BluePen <= 500)
            {
                Discount = 0.10;
            }
            else if (501 <= BluePen && BluePen <= 1000)
            {
                Discount = 0.20;
            }
            else if (1001 <= BluePen && BluePen <= 2000)
            {
                Discount = 0.35;
            }
            else
            {
                Discount = 0.50;
            }

            SaleBP = 0.20 * BluePen * Discount;
            npBluePen = 0.50 * SaleBP;

            cout<< "Current price: RM " << SaleBP <<endl;

            break;


        case 'b': case 'B':
            // Enter quantity of One inch thick notebook

            cout<< "You choose to buy One inch thick notebook. \n" ;
            cout<< "How many units you want to buy? \n" ;
            cout<< "Quantity: " ;
            cin>> Notebook ;

            if (1 <= Notebook && Notebook <= 500)
            {
                Discount = 0.10;
            }
            else if (501 <= Notebook && Notebook <= 1000)
            {
                Discount = 0.20;
            }
            else if (1001 <= Notebook && Notebook <= 2000)
            {
                Discount = 0.35;
            }
            else
            {
                Discount = 0.50;
            }

            SaleNB = 2.50 * Notebook * Discount;
            npNotebook = 0.40 * SaleNB;

            cout<< "Current price: RM " << SaleNB <<endl;

            break;


        case 'c': case 'C':
            // Enter quantity of Two-pocket plastic folder

            cout<< "You choose to buy Two-pocket plastic folder. \n" ;
            cout<< "How many units you want to buy? \n" ;
            cout<< "Quantity: " ;
            cin>> Folder ;

            if (1 <= Notebook && Notebook <= 500)
            {
                Discount = 0.10;
            }
            else if (501 <= Notebook && Notebook <= 1000)
            {
                Discount = 0.20;
            }
            else if (1001 <= Notebook && Notebook <= 2000)
            {
                Discount = 0.35;
            }
            else
            {
                Discount = 0.50;
            }   

            SaleFD = 0.50 * Folder * Discount;
            npFolder = 0.60 * SaleFD;

            cout<< "Current price: RM " << SaleFD <<endl;

            break;


        case 'd': case 'D':

            // Enter quantity of 200-pages blank planner

            cout<< "You choose to buy 200-pages blank planner. \n" ;
            cout<< "How many units you want to buy? \n" ;
            cout<< "Quantity: " ;
            cin>> Planner ;

            if (1 <= Planner && Planner <= 500)
            {
                Discount = 0.10;
            }
            else if (501 <= Planner && Planner <= 1000)
            {
                Discount = 0.20;
            }
            else if (1001 <= Planner && Planner <= 2000)
            {
                Discount = 0.35;
            }
            else
            {
                Discount = 0.50;
            }

            SalePL = 2.50 * Planner * Discount;
            npPlanner = 0.50 * SalePL;

            cout<< "Current price: RM " << SalePL <<endl;
            break;

        case 'e': case 'E':
            TotalSales = SaleBP + SaleNB + SaleFD + SalePL;

            break;


        default:
            // Item not in our menu
            cout<< "Sorry, no item option in the system. Please select again."<<endl;

        }
        break;

    case 'b': case 'B':

        // process
        TotalPaid = PaidBP + PaidNB + PaidFD + PaidPL ; // Total paid amount.
        TotalUnpaid = UnpaidBP + UnpaidNB + UnpaidFD + UnpaidPL ; // Total unpaid amount.
        NetProfit = npBluePen + npNotebook + npFolder + npPlanner ; // Total net profit.


        // output
        cout<< "a.    Total quantity ordered for each item:" <<endl;
        cout<< "  Blue pen 1.0 point          : "<< BluePen <<endl;
        cout<< "  One inch thick notebook     : "<< Notebook <<endl;
        cout<< "  Two-pocket plastic folder   : "<< Folder <<endl;
        cout<< "  200-pages blank planner     : "<< Planner <<endl<<endl;


        cout<< "b.    Sale amount for each item:" <<endl;
        cout<< "  Blue pen 1.0 point          : "<< SaleBP <<endl;
        cout<< "  One inch thick notebook     : "<< SaleNB <<endl;
        cout<< "  Two-pocket plastic folder   : "<< SaleFD <<endl;
        cout<< "  200-pages blank planner     : "<< SalePL <<endl<<endl;


        cout<< "c.    Paid amount for each item:" <<endl;
        cout<< "  Blue pen 1.0 point          : "<< PaidBP <<endl;
        cout<< "  One inch thick notebook     : "<< PaidNB <<endl;
        cout<< "  Two-pocket plastic folder   : "<< PaidFD <<endl;
        cout<< "  200-pages blank planner     : "<< PaidPL <<endl<<endl;


        cout<< "d.    Unpaid amount for each item:" <<endl;
        cout<< "  Blue pen 1.0 point          : "<< UnpaidBP <<endl;
        cout<< "  One inch thick notebook     : "<< UnpaidNB <<endl;
        cout<< "  Two-pocket plastic folder   : "<< UnpaidFD <<endl;
        cout<< "  200-pages blank planner     : "<< UnpaidPL <<endl<<endl;      


        cout<< "e.    Total paid amount: "<< TotalPaid <<endl;
        cout<< "f.    Total unpaid amount: "<< TotalUnpaid <<endl;
        cout<< "g.    Net profit gained: "<< NetProfit <<endl;

    break;

    case 'c': case 'C':

    break;

    default:

    ;

    }

    return 0;
}

If you read the error messages, they usually tell you what the problem is and what line it's on. Reading and understanding compiler error messages is something that takes a little practice. Tell us the complete first error, and make sure that the line numbers in your code above match the line numbers on your actual code editor.

We can then tell you what the error means and you can fix it yourself.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.