
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;
}


Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 3 images

- The language is Python Build a UML Diagram for the CellPhone class (The picture attatched below is what you need to reference when answering the question.)arrow_forwardProgramming Exercise 10-1arrow_forwardUsing C# language: Programming PLO-2 Measured: Design, implement, and evaluate computer solutions utilizing structured and object-oriented programming methodologies. Design a class named Contractor. The class should keep the following information: Contractor name Contractor number Contractor start date Write one or more constructors and the appropriate accessor and mutator functions for the class.arrow_forward
- 6 Javaarrow_forwardQ2: Write a c++ program that implements the following UML diagram including functions and constructors' definitions. In addition to the user program code that declares object for each class and show how the derived class object uses the base class members. OOPCourse Student ID: int Grades[5]: int + setgrades(int arr[], int ): void + setID(int): int + setage(int): double + print():void + age:int + OOPstudent() OOPCourse OOPLAB OOPLab Reports[4]: int + setmarks(int arr[), int ): void + print():void + OOPLab()arrow_forwardc++ programmingarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





