Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program that has the following components: a) A struct type named cellPhone which will describe a cell phone. The following information should

Write a C++ program that has the following components:

a) A struct type named cellPhone which will describe a cell phone. The following information should be included:

brand (string)

model (string)

weight (double)

price (double)

b) Write a function to read values into the member variables of type cellPhone. (The struct variable should be passed as an argument). The order in which the data is read is the same as that of the items in the struct.

c) Write a function to compare the content of 2 variables of type cellPhone which should return true if the values are the same and false otherwise.

d) Write a function to display the data of an object cellphone with a descriptive message of your choice.

e) Using your function, your main function should:

a. Create 3 variables of type cellphone.

b. Prompt the user for the data to be stored in each variable of type cellPhone. Be sure to have 2 of the variables with exactly the same information.

c. Compare the 3 cellPhone objects 2 at a time to see if they are the same.

Here is a sample output to illustrate the expected behavior of your program.image text in transcribedNEED THIS IN C++

C:Windows system32 cmd.exe Practice Srtructures! nter data for 1st phone rand of phone: Huawei hone model: Mate 10 Lite leight of phone in kg: .164 hone price: 374.79 nter data for 2nd phone rand of phone- Huawe1 hone model: Mate 10 Lite leight of phone in kg: .164 hone price: 374.79 nter data for 3rd phone rand of phone: Apple hone model: iPhone_8_Plus leight of phone in kg: .202 hone price: 360 omparing the folloving 2 phones he two phones are the same omparing the toIlowing 2 phones Phone is a Huavei, Mate _10 Lite which weighs 0.164kgs and costs $374.79 Phone is a Huawei. Mate_10_Lite which weighs 0.164kgs and costs $374.79 Phone is a Huawei. Mate 10Lite which weighs 0.164kgs and costs $374.79 Phone is a Apple. iPhone_8_Plus which weighs 0.202kgs and costs $360 he two phones are NOT the sane omparing the toIlowing 2 phones Phone is a Huawei. Mate 10_Lite which weighs 0.164kgs and costs $374.79 Phone is a Apple. iPhone_8_Plus which weighs 0.202kgs and costs $360 he two phones are NOT the sane ope you are comfortable with the use of structures now

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions