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 #: 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 inputoutput
You want to rate a mobile phone, according to the following conditions:
i Price should be less than AED.
ii Screen size should be at least inches
iii Weight should be less than gms
Your ratings are as follows:
stars, if all the conditions above are met.
stars, if condition i and ii are met only
stars, if condition ii and iii are met only
stars, if condition i and iii are met only
stars, if none of the conditions above are met.
Sample inputoutput:
Please enter the price of the phone
Please enter the screen size:
please enter the weight of the phone in grans:
stars
Please enter the price of the phone:b
Please enter the screen size:
Please enter the veight the phone grans:
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
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
I
if screenSize
if weight
cout stars" endl;
r
else
cout stars" endl;
r
else
if weight
cout stars" endl;
t
else
cout stars" endl;
r
else
if screensize && weight
cout stars" endl;
else
if price && weight
I
cout stars" endl;
else
cout stars" endl;
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
