Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

***URGENT PLEASE HELP*** Must be written in C++ Please following instructions carefully DIY (50%) Except for the mandatory sections of DIY, all the other parts

***URGENT PLEASE HELP***

Must be written in C++

Please following instructions carefully

image text in transcribed

image text in transcribedimage text in transcribed

image text in transcribed

image text in transcribedimage text in transcribed

DIY (50\%) Except for the mandatory sections of DIY, all the other parts can be changed by students if they find it necessary as long as the program produces an output that exactly matches the required output. Please note that you can (and probably should) add more member functions to make the DIY part work. Your task for this part is to create a program that provides a class called Store. This class can be instantiated by store name and the number of toys that can be added. Then the Toys will be added one at a time to the Store by toy name, SKU number, price and toy age. A toy can be searched by its SKU number to find out if it is on sale or not. The Stores Toy list then can be displayed as follows, listing all the toys' names, their SKU numbers, age and price. Price varies and depends on if toys are on sale or not. Sample List Implementation Implement this program in two modules (i.e., classes): Store and Toys Toys Module define the following constant in the Toys header file: MAX_TNAME; // define it to 31. The maximum length of a Toy name The Toy class should have the following member variables: - char m_tname;// toy name, up to MAX_TNAME size - int m_sku; //SKU number, maximum 8 digits long - double m_price;//toy price - int mage;//toy according to age group - bool m_onSale;// keep track, if toys are on sale or not The followings are the mandatory public member functions: - void addToys(const char* tname, int sku, double price,int age); After checking the validity, this method will set the received values to the appropriate data members. Otherwise will be set to an empty state. - void isSale(bool sale); It will assign the received value to the data member m_onSale. - void calSale(; It will decrease the toys price to 20% then the original price. - void display0const; If a Toy object is valid a) prints m tname with width 15 , left justified and filled with empty spaces. b) prints msku with width 10 c) prints mage with width 6 d) prints m_price with width 12 and after the decimal point 2 digits. e) If the toy is on sale it will print "On Sale" with width 10 . Otherwise, print empty spaces with width 8. 2. otherwise prints, "Invalid Toy". Store Vodule define the following constant in the Store header file: MAX_NUM_TOYS; //define it to 10. The maximum number of toys that could be added. MAX_SNAME; // define it to 31. The maximum length of a store name The Store class should have the following member variables: - char m_sName;// Store name, up to MAX_SNAME size - int m_noOfToys://No of toys; - int m_addToys;/o of toys added - Toys m_toy;// statically array of toys with size MAX_NUM_TOYS The followings are the mandatory public member functions: - void setStore(const char* sName, int no); This will set the store name and the number of toys that could be added to the store. For invalid value, it will set the values to an empty state. - void setToys(const char* tname, int sku, double price,int age); This will add the toys one at a time to the mtoy array and will keep track of the number of toys added. Toys will be added until num of added toys is less than m_noOfToys - void display0const; If a Store object is valid a) prints " " " with width 60 and fill with "", then print m_sName and a new line. b) prints "*" with width 60 and fill with " ", then prints "list of the toys" and a new line. c) prints "SKU" with width 30 and fill with empty spaces d) prints "Age" with width 10 and fill with empty spaces e) prints "Price" with width 11 and fill with empty spaces f) prints "Sale" with width 10 and fill with empty spaces then a new line g) prints all the toys information. For details see the sample output. 2. otherwise prints, "Invalid Store" then a new line. - void find(int sku); This method will go through the arrays of toys. It will match the received SKU number with the stored toys' SKU number to find out if the toys are on sale or not. If the number matches then it will pass true to the appropriate Toys method. After that, it will call the calSale() of the toys class to know the sale value. - void setEmpty0: Tester Program // 00p244 Workshop 3 Part2: Member Functions and Privacy // file main.cpp // Version 1. I/ Author Nargis Khan // Description // Tests store module f/ // Revision History // // Name Date Reason If 1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1 \#include \#includercstring> \#include"Store.h" using namespace std; using namespace sdds; int main() \{ Store 5 ; cout "Printing invalid list of Toys" endl; s.setStore("****Children"s Dream store****", 2); s.setToys(nu1lptr, 20304576, 12.56,2); 5.setToys ("Car", 203e45, 11. 50, 12); s.display(); cout endl "Printing valid list of Toys" endl; s.setstore("****Children's Dream store****", 6); 5.setToys("Racing Car", 11223344, 40.99, 8); 5.setToys("Teddy Bear", 33772346,25.99,6); 5.setToys ("Airplane", 44453466,60.99,16 ); s.setToys("Dol1", 55887896,45.99, 5); s.setToys("Drone", 99221388,90.99,18 ); 5.setToys("Lego", 88224596,65.99,10 ); s.display(); cout endl "Searching for toys and printing the list with sale price" endi; s.find (33772346); 5.find(99221388); s.find ( 88224596); s.display(); \} Execution Sample Printing invalid list of Toys ****Children's Dream store**** list of the toys Toy[1] : Invalid Toy SKU Age Price Sale Toy[2] :Invalid Toy Printing valid list of Toys ****Children's Dream store**** list of the toys Toy[1]:RacingCarToy[2]:TeddyBearToy[3]:AirplaneToy[4]:DollToy[5]:DroneToy[6]:LegoSKU112233443377234644453466558878969922138888224596Age861651816Price46.9925.9969.9945.9990.9965.99Sale Searching for toys and printing the list with sale price ****Children's Dream store**** list of the toys Toy[1]:RacingCarToy[2]:TeddyBearToy[3]:AirplaneToy[4]:DollToy[5]:DroneToy[6]:LegoSKU112233443377234644453466558878969922138888224596Age861651810Price46.9926.7960.9945.9972.7952.79SaleOnSaleOnSaleOnSale Retlection Study your final solutions for each deliverable of the workshop, reread the related parts of the course notes, and make sure that you have understood the concepts covered by this workshop. This should take no less than 30 minutes of your time and the result is suggested to be at least 150 words in length. Create a file named reflect.txt that contains your detailed description of the topics that you have learned in completing this workshop and mention any issues that caused you difficulty. You may be asked to talk about your reflection (as a presentation) in class. Part 2 Submission (DIY) Files to submit: reflect.txt Store.cpp Store.h Toys.cpp Toys.h main.cpp

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

1. Let a, b R, a Answered: 1 week ago

Answered: 1 week ago