Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help fixing my code. all if rather than if else else if ( frg < ' z ' ) { cout < <

I need help fixing my code. all if rather than if else
else if(frg <'z'){
cout <<"
An invaild Region of the Golf Course was selected.";
Is not correct would be correct as an else only if you had used if-else #include
#include
using namespace std;
int main()
{
float fr;
float in;
char frg;
cout << "Fall 2023 Automated \"Bruin\" Golf Course Sprinkler System" << endl;
cout << "What is the temputure in degrees (F)?";
cin >> fr;
cout <<"
How much precipitation today (in inches)?";
cin >> in;
cout <<"
The Golf course grass divisions are F-Fairways R-Rough Greens
";
cout << "Which do you chose (FRG)?";
cin >> frg;
if (frg =='F'||frg =='f'){
if (fr <34|| in >0.475){
cout <<"
Given the temperature is "<< fr <<" degrees and "<< setprecision(4)<< in <<" inches of precipitation today
The Fairways on the Golf Course will not be watered.";
}
else{
cout <<"
Given the temperature is "<< fr <<" degrees and "<< setprecision(4)<< in <<" inches of precipitation today
The Fairways on the Golf Course will be watered.";
}
}
if (frg =='R'||frg =='r'){
if (fr <34|| in >0.135){
cout <<"
Given the temperature is "<< fr <<" degrees and" << setprecision(4)<< in << "inches of precipitation today
The Rough on the Golf Course will not be watered.";
}
else{
cout <<"
Given the temperature is "<< fr <<" degrees and "<< setprecision(4)<< in <<" inches of precipitation today
The Rough on the Golf Course will be watered.";
}
}
if (frg =='G'||frg =='g'){
if (fr <34|| in >0.775){
cout <<"
Given the temperature is "<< fr <<" degrees and" << setprecision(4)<< in << "inches of precipitation today
The Greens on the Golf Course will not be watered.";
}
else{
cout <<"
Given the temperature is "<< fr <<" degrees and "<< setprecision(4)<< in <<" inches of precipitation today
The Greens on the Golf Course will be watered.";
}
}
else if(frg <'z'){
cout <<"
An invaild Region of the Golf Course was selected.";
}
return 0;
}

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

Database Modeling And Design

Authors: Toby J. Teorey, Sam S. Lightstone, Tom Nadeau, H.V. Jagadish

5th Edition

0123820200, 978-0123820204

More Books

Students also viewed these Databases questions