Suppose you are asked to build an application for a mobile showroom to maintain stock. Design a class for mobile phone h

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Suppose you are asked to build an application for a mobile showroom to maintain stock. Design a class for mobile phone h

Post by answerhappygod »

Suppose you are asked to build an application for a mobile showroom to maintain stock.
Design a class for mobile phone having unique serial number, unique IMEI number (8-digit), model and price. IMEI number should be automatically generated every time you create a mobile starting from 101.
Mobile class has the following functions
a. Define a constructor to set default values for mobile phone as model="LG", IMEI=12345678 and price=10000
b, Define a parameterized constructor to set model and price with used-defined input for model, IMEI and price
b. Print data members (IMEI, model price)
c. Update price : update price to new price( half of old price) only if its IMEI number has the alternating parity pattern i.e. if 1st digit (right most digit) is odd, second digit is even and vice versa; third digit is odd, fourth digit is even and vice-versa, and so on.
For example, the IMEI numbers 34879618, 12345678, 12434567 are having alternating parity pattern.
Write main function to test your class.
In main, create 4 mobile phone objects such a way that for first object, you should set default values; for rest of the objects you should set user-defined input.
Print details of all the mobile objects after updating the price.
Input format :
details (IMEI, model and price) of mobile objects // line-2 to line n+1
Output format :
details (IMEI, model and updated price) of all mobile phones (first object, second object......)
I need c++ and algorithm also
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply