Question: Exercise # 3 : Fix and Code Given below are a question, and the code for the answer. However, the code includes syntax and logical

Exercise #3: Fix and Code
Given below are a question, and the code for the answer. However, the code includes syntax and logical errors. Find the errors and fix the code to get the sample input/output.
You want to rate a mobile phone, according to the following conditions:
(i) Price should be less than 1500 AED.
(ii) Screen size should be at least 4 inches
(iii) Weight should be less than 200 gms.
Your ratings are as follows:
5 stars, if all the conditions above are met.
4 stars, if condition (i) and (ii) are met only
3 stars, if condition (ii) and (iii) are met only
2 stars, if condition (i) and (iii) are met only
0 stars, if none of the conditions above are met.
Sample input/output:
Please enter the price of the phone P1660
Please enter the screen size:5.5
please enter the weight of the phone in grans:160
stars
Please enter the price of the phone:180b
Please enter the screen size:5.1
Please enter the veight of the phone in grans:199
5 stars
For every error you find, fix it and add a comment explaining the change you have made.
//tinclude cistream>- istream should be iostream
Minclude ciostream>
using namespace std;
int main()
1
float price, screenSize, weight;
cout "Enter the price of the mobile phone (in AED): ";
cin prie;
cout "Enter the screen size of the mobile phone (in inches): ";
cin screenSize;
cout "Enter the weight of the mobile phone (in grams): "
cin weight;
if (price 1500)
I
if (screenSize 4)
if (weight 200)
1
cout "5 stars" endl;
r
else
1
cout "4 stars" endl;
r
else
if (weight 200)
1
cout 3 stars" endl;
t
else
1
cout "1 stars" endl;
r
else
if (screensize 4&& weight 200)
1
cout "3 stars" endl;
}
else
if (price ==1500&& weight ==200)
I
cout "2 stars" endl;
else
1
cout "0 stars" endl;
1
return 0 ;
 Exercise #3: Fix and Code Given below are a question, and

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!