Create a flowchart for the program shown. (Nested If Statement)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Create a flowchart for the program shown. (Nested If Statement) 

1
#include<iostream> //
2
using namespace std;
4
int main()
{
7
double grade;
10
double majorexam, longquiz1,
longquiz2, activity, shortquiz1,
shortquiz2, shortquiz3;
double totalmajorexam,
11
totallongquiz, totalactivity,
totalshortquiz;
12
13
cout << "Enter score in major
exam: ";
14
cin >> majorexam;
15
cout << "\n\nEnter score in long
quiz 1: ";
cin >> longquiz1;
cout << "\n\nEnter score in long
quiz 2: ";
cin >> longquiz2;
16
17
18
19
cout << "\nEnter score in
activity: ";
cin >> activity;
20
21
cout << "\n\nEnter score in short
quiz 1: ";
22
cin >> shortquiz1;
23
cout << "\n\nEnter score in short
quiz 2: ";
cin >> shortquiz2;
24
25
cout << "\n\nEnter score in short
quiz 3: ";
cin >> shortquiz3;
26
27
28
cout << "Enter total score in
major exam: ";
cin >> totalmajorexam;
29
30
cout << "\n\nEnter total score in
long quiz: ";
cin >> totallongquiz;
31
32
cout << "\nEnter total score in
activity: ";
cin >> totalactivity;
33
34
cout << "\n\nEnter total score in
short quiz: ";
cin >> totalshortquiz;
35
36
37
grade = (0.30*(majorexam/
totalmajorexam) + 0.25*(((1longquiz1
+longquiz2)/2)/totallongquiz)
+ 0.25*(activity/totalactivity)+
38
39
0.20*(((shortquiz1+shortquiz2
+shortquiz3)/3)/totalshortquiz));
40
41
if(grade >= 98 && grade <=100)
Transcribed Image Text:1 #include<iostream> // 2 using namespace std; 4 int main() { 7 double grade; 10 double majorexam, longquiz1, longquiz2, activity, shortquiz1, shortquiz2, shortquiz3; double totalmajorexam, 11 totallongquiz, totalactivity, totalshortquiz; 12 13 cout << "Enter score in major exam: "; 14 cin >> majorexam; 15 cout << "\n\nEnter score in long quiz 1: "; cin >> longquiz1; cout << "\n\nEnter score in long quiz 2: "; cin >> longquiz2; 16 17 18 19 cout << "\nEnter score in activity: "; cin >> activity; 20 21 cout << "\n\nEnter score in short quiz 1: "; 22 cin >> shortquiz1; 23 cout << "\n\nEnter score in short quiz 2: "; cin >> shortquiz2; 24 25 cout << "\n\nEnter score in short quiz 3: "; cin >> shortquiz3; 26 27 28 cout << "Enter total score in major exam: "; cin >> totalmajorexam; 29 30 cout << "\n\nEnter total score in long quiz: "; cin >> totallongquiz; 31 32 cout << "\nEnter total score in activity: "; cin >> totalactivity; 33 34 cout << "\n\nEnter total score in short quiz: "; cin >> totalshortquiz; 35 36 37 grade = (0.30*(majorexam/ totalmajorexam) + 0.25*(((1longquiz1 +longquiz2)/2)/totallongquiz) + 0.25*(activity/totalactivity)+ 38 39 0.20*(((shortquiz1+shortquiz2 +shortquiz3)/3)/totalshortquiz)); 40 41 if(grade >= 98 && grade <=100)
42
{
43
cout << "1.00";
44
}
45
else if( grade >= 95 && grade
<=97)
46
{
47
cout << "1.25";
48
49
else if( grade >= 92 && grade
<=94)
50
{
51
cout << "1.50";
52
}
53
else if( grade >= 89 && grade
<=91)
54
{
55
cout << "1.75";
56
}
57
else if( grade >= 86 && grade
<=88)
58
{
59
cout << "2.00";
60
61
else if( grade >= 83 && grade
<=85)
62
{
63
cout << "2.25";
64
}
65
else if( grade >= 80 && grade
<=82)
66
{
67
cout << "2.50";
68
}
69
else if( grade >= 77 && grade
<=79)
70
{
71
cout << "2.75";
72
}
73
else if( grade >= 74 && grade
<=76)
74
{
75
cout << "3.0";
76
}
else if( grade >= 71 && grade
<=73)
77
78
{
79
cout << "INC";
80
}
81
else if( grade <=70){
82
cout << "Failed";
83
}
84
return 0;
85
}
86
Transcribed Image Text:42 { 43 cout << "1.00"; 44 } 45 else if( grade >= 95 && grade <=97) 46 { 47 cout << "1.25"; 48 49 else if( grade >= 92 && grade <=94) 50 { 51 cout << "1.50"; 52 } 53 else if( grade >= 89 && grade <=91) 54 { 55 cout << "1.75"; 56 } 57 else if( grade >= 86 && grade <=88) 58 { 59 cout << "2.00"; 60 61 else if( grade >= 83 && grade <=85) 62 { 63 cout << "2.25"; 64 } 65 else if( grade >= 80 && grade <=82) 66 { 67 cout << "2.50"; 68 } 69 else if( grade >= 77 && grade <=79) 70 { 71 cout << "2.75"; 72 } 73 else if( grade >= 74 && grade <=76) 74 { 75 cout << "3.0"; 76 } else if( grade >= 71 && grade <=73) 77 78 { 79 cout << "INC"; 80 } 81 else if( grade <=70){ 82 cout << "Failed"; 83 } 84 return 0; 85 } 86
Expert Solution
steps

Step by step

Solved in 2 steps with 4 images

Blurred answer
Knowledge Booster
Concept of Flowchart
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.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education