Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question

Based on that code can u please check the given class diagram is correct or not...If the class diagram is correct please give the short explanation for each box. And if the class diagram is not correct then please make the correct class diagram and give the explanation for each box as well...

 

code:

#include <iostream>

#include <string>

using namespace std;

 

class Product{

  public:

    string name;

    double price;

    Product(string m_name, double m_price)

    {

      name = m_name;

      price = m_price;

    }

};

 

void printLine()

{

  for(int i = 0; i<60; i++)

    cout << "_";

  cout << endl << endl;

}

 

int main()

{

  Product *arr[4];

  arr[0] = new Product("A", 10);

  arr[1] = new Product("B", 20);

  arr[2] = new Product("C", 30);

  arr[3] = new Product("D", 40);

  int uid;

  string name, address, state;

  int pno, poscode;

  double shipping;

  cout << "\t\t\tWELCOME" << endl;

  printLine();

  cout << "\t\tEnter User Id: ";

  cin >> uid;

   

  char ch = 'Y';

  do

  {

    system("clear");

    cout << "\t\t\tCUSTOMER DETAIL" << endl;

    printLine();

    cout << "\tNAME | ";

    cin.ignore();

    getline(cin, name);

    cout << "\tPHONE NUMBER | ";

    cin >> pno;

    cout << "\tADDRESS | ";

    cin.ignore();

    getline(cin, address);

    cout << "\tPOSCODE | ";

    cin >> poscode;

    cout << "\tSTATE | ";

    cin.ignore();

    getline(cin, state);

    cout << "\tSHIPPING COST | ";

    cin >> shipping;

    cout << endl << endl;

    cout << "\tProceed to Product Detail?" << endl << "\t(Y) YES" << endl << "\t(N) RESET" << endl;

    cout << "\tChoice | ";

    cin >> ch;

  }while(ch != 'Y');

  system("clear");

  ch = 'Y';

  int count = 0;

  char products[100];

  int quantity[100];

  int discount;

  do

  {

    system("clear");

    cout << "\t\t\tPRODUCT DETAIL" << endl;

    printLine();

    for(int i = 0; i < 4; i++)

    {

      cout << "\t" << '(' << (char)('A' + i) << ") |PRODUCT " << arr[i]->name

        << " ------ RM " << arr[i]->price << " |" << endl;

    }

    cout << endl << endl << "\t|DISCOUNT CODE:" << endl;

    cout << "\t[disc50\%]" << endl << "\t[disc25\%]" << endl;

    char choice = '0';

    count = 0;

    do

    {

      cout << endl << " INSERT PRODUCT ";

      if(choice != '0')

      {

        cout << "(IF NO PRESS \'0\') ";

      }

      cout << "| ";

      cin >> choice;

      if(choice == '0')

        break;

      cout << " INSERT QUANTITY | ";

      cin >> quantity[count];

      products[count] = choice;

      count++;

    } while(choice != '0');

    cout << endl << " DISCOUNT CODE | ";

    cin >> discount;

    cout << endl;

    cout << " Proceed to Billing?" << endl << " (Y) YES" << endl << " (N) RESET" << endl;

    cout << " Choice | ";

    cin >> ch;

  }while(ch != 'Y');

  system("clear");

  cout << "\t\t\tRECEIPT" << endl;

  printLine();

   

  cout << " " << name << "\n " << pno << "\n "

    << address << "\n " << poscode << "\n "

    << state << endl << endl;

   

  double total = 0;

  for(int i = 0; i < count; i++)

  {

    cout << " Product " << products[i] << " Qty-" << quantity[i] << endl;

    total = total + (arr[products[i] - 'A']->price * quantity[i]);

  }

  cout << " Amount  - RM" << total << endl;

  cout << " Discount " << discount << "\%" << endl;

  cout << " Shipping - RM" << shipping << endl;

  total = (total * discount) / 100.0 + shipping;

  cout << " Total  - RM" << total << endl << endl;

  cout << " PIC - " << uid << endl << endl;

  cout << "\t\tTHANK YOU FOR SHOPPING WITH US !" << endl;

  return 0;

}

Customer
Orders
OrderDetails
- orderlD: int
- productID: int
- productName: string
- quantity: int
- cost: float
- subtotal: float
- orderlD: int
- customeriD: int
- customerName: string
- customerAddress: string
|- customerPhone: string
|- customerEmail: string
- orderDate: string
0.
- customerID: int
- orderStatus: string
+ registerCustomer(0
+ updateCustomerDetails()
+ login()
+ placeOrder()
0.
ShoppingCart
User
Products
|- shoppingcartID: int
- productiD: int
|- quantity: int
|- userlD: string
- userPassword: string
productID: int
- productName: string
- productType: string
- productSize: int
|- productWorkmanship: string
- loginStatus: string
+ addProduct()
+ updateShoppingcart()
+ checkOut()
+ filterProducts
-searchProducts
Payment
paymentID: int
paymentMethod: string
|
expand button
Transcribed Image Text:Customer Orders OrderDetails - orderlD: int - productID: int - productName: string - quantity: int - cost: float - subtotal: float - orderlD: int - customeriD: int - customerName: string - customerAddress: string |- customerPhone: string |- customerEmail: string - orderDate: string 0. - customerID: int - orderStatus: string + registerCustomer(0 + updateCustomerDetails() + login() + placeOrder() 0. ShoppingCart User Products |- shoppingcartID: int - productiD: int |- quantity: int |- userlD: string - userPassword: string productID: int - productName: string - productType: string - productSize: int |- productWorkmanship: string - loginStatus: string + addProduct() + updateShoppingcart() + checkOut() + filterProducts -searchProducts Payment paymentID: int paymentMethod: string |
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education