The following question support the attainment of Course Intended Learning Outcomes (CILO): Design computing based solution using control structures, functions, array and other statements. INSTRUCTION: Read and study the assignment below. Solve the problem using C++ programming language, compile, run and screen shot the correct output. Copy and paste the source code or program code and the required sample output (screen shot) in the format below. The output should also display the school name, course name, student name, program, section, date and title of assessment task. PROBLEM: Write a program that will let the user to input year level and status base on table below. The output should be based on the possible combination of year level and status. GENDER AGE OUTPU INPUT OUTPUT INPUT T F or f M or m Female 1 to 17 Minor Male 18 to 59 Adult Other 60 and above Invalid Senior input Others Invalid //Sample if , if-else and nested if #include using namespace std; main() { cout<<("*** USING NESTED IF STATEMENT ****"); cout<<("\nEnter your gender : "); cin>> gender; cout<<("\nEnter your age : "); cin>> age; if (gender == 'F'" || gender == 'f') { if ( age >=1 && age <=17) int age; char gender; cout<<" \nFemale & Minor"; else if ( age >=18 && age <=59) cout<<" \nFemale & adult"; else if (age >= 60) cout<<"\nFemale & Senior"; else cout<<"Female & Invalid"; } L else if (gender == 'M' || gender == 'm') { if ( age >=1 && age <=17) cout<<" \nMale & Minor"; else if ( age >=18 && age <=59) cout<<" \nMale & adult"; else if (age >= 60) cout<<" \nMale & Senior"; else cout<<"Male & Invalid"; else { if ( age >=1 && age <=17) cout<<" \nInvalid & Minor"; else if ( age >=18 && age <=59) cout<<" \nInvalid & adult"; else if (age >= 60) cout<<" \nInvalid & Senior"; else cout<<" \nlnvalid & Invalid"; O C:\Users\TIPQC\Desktop\UAC\C++ Program\Sample_nest.. *** USING NESTED IF STATEMENT **** Enter your gender : f Enter your age : 46 Female & adult Process exited after 16.9 seconds w Press any key to cont inue O C:\Users\TIPQC\Desktop\JAC\C++ Program,.. *** USING NESTED IF STATEMENT **** Enter your gender : n Enter your age : 12 Male & Minor Process exited after 16.28 seconds with retu Press any key to continue

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter7: File Handling And Applications
Section: Chapter Questions
Problem 7PE
icon
Related questions
Question
ASSESSMENT TASK: Sample Selection Control Structure using Nested If condition
The following question support the attainment of Course Intended Learning Outcomes
(CILO): Design computing based solution using control structures, functions, array and
other statements.
INSTRUCTION: Read and study the assignment below. Solve the problem using C++
programming language, compile, run and screen shot the correct output. Copy and
paste the source code or program code and the required sample output (screen shot) in
the format below. The output should also display the school name, course name,
student name, program, section, date and title of assessment task.
PROBLEM: Write a program that will let the user to input year level and status base on table
below. The output should be based on the possible combination of year level and status.
GENDER
AGE
OUTPU
INPUT
OUTPUT
INPUT
For f
Female
1 to 17
Minor
M or m
Male
18 to 59
Adult
Other
60 and
Invalid
Senior
input
above
Others
Invalid
//Sample if , if-else and nested if
#include<iostream>
using namespace std;
main()
{
cout<<("*** USING NESTED IF STATEMENT ****");
cout<<("\nEnter your gender : "); cin>> gender;
cout<<("\nEnter your age: "); cin>> age;
if (gender == 'F' || gender == 'f')
{ if ( age >=1 && age <=17)
int age; char gender;
cout<<" \nFemale & Minor";
else if ( age >=18 && age <=59)
cout<<" \nFemale & adult";
else if (age >= 60)
cout<<"\nFemale & Senior";
else cout<<"Female & Invalid";
}
else if (gender == 'M' || gender == 'm')
{ if ( age >=1 && age <=17)
cout<<" \nMale & Minor";
else if ( age >=18 && age <=59)
cout<<" \nMale & adult";
else if (age >= 60)
cout<<" \nMale & Senior";
else cout<<"Male & Invalid";
else
{ if ( age >=1 && age <=17)
cout<<" \nInvalid & Minor";
else if ( age >=18 && age <=59)
cout<<" \nInvalid & adult";
else if (age >= 60)
cout<<" \nlnvalid & Senior";
else
cout<<" \nlnvalid & Invalid";
I C:\Users\TIPQC\Desktop\JAC\C++ Program\Sample_nest..
*** USING NESTED IF STATEMENT ****
Enter your gender
: f
Enter your age
: 46
Female & adult
Process exited after 16.9 seconds w
Press any key to cont inue
O C:\Users\TIPQC\Desktop\JAC\C++ Program,.
*** USING NESTED IF STATEMENT
Enter your gender
****
: m
Enter your age
: 12
Male & Minor
Process exited after 16.28 seconds with retu
Press any key to continue
Transcribed Image Text:ASSESSMENT TASK: Sample Selection Control Structure using Nested If condition The following question support the attainment of Course Intended Learning Outcomes (CILO): Design computing based solution using control structures, functions, array and other statements. INSTRUCTION: Read and study the assignment below. Solve the problem using C++ programming language, compile, run and screen shot the correct output. Copy and paste the source code or program code and the required sample output (screen shot) in the format below. The output should also display the school name, course name, student name, program, section, date and title of assessment task. PROBLEM: Write a program that will let the user to input year level and status base on table below. The output should be based on the possible combination of year level and status. GENDER AGE OUTPU INPUT OUTPUT INPUT For f Female 1 to 17 Minor M or m Male 18 to 59 Adult Other 60 and Invalid Senior input above Others Invalid //Sample if , if-else and nested if #include<iostream> using namespace std; main() { cout<<("*** USING NESTED IF STATEMENT ****"); cout<<("\nEnter your gender : "); cin>> gender; cout<<("\nEnter your age: "); cin>> age; if (gender == 'F' || gender == 'f') { if ( age >=1 && age <=17) int age; char gender; cout<<" \nFemale & Minor"; else if ( age >=18 && age <=59) cout<<" \nFemale & adult"; else if (age >= 60) cout<<"\nFemale & Senior"; else cout<<"Female & Invalid"; } else if (gender == 'M' || gender == 'm') { if ( age >=1 && age <=17) cout<<" \nMale & Minor"; else if ( age >=18 && age <=59) cout<<" \nMale & adult"; else if (age >= 60) cout<<" \nMale & Senior"; else cout<<"Male & Invalid"; else { if ( age >=1 && age <=17) cout<<" \nInvalid & Minor"; else if ( age >=18 && age <=59) cout<<" \nInvalid & adult"; else if (age >= 60) cout<<" \nlnvalid & Senior"; else cout<<" \nlnvalid & Invalid"; I C:\Users\TIPQC\Desktop\JAC\C++ Program\Sample_nest.. *** USING NESTED IF STATEMENT **** Enter your gender : f Enter your age : 46 Female & adult Process exited after 16.9 seconds w Press any key to cont inue O C:\Users\TIPQC\Desktop\JAC\C++ Program,. *** USING NESTED IF STATEMENT Enter your gender **** : m Enter your age : 12 Male & Minor Process exited after 16.28 seconds with retu Press any key to continue
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Concept of Parenthesis
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,