Question 1 a) Write a program that reads in the radius and length of a cylinder and computes volume using the following formulas: area radius *radius " PI volume area "length Write the variable definitions for each of the following: i a character variable named Label i an integer variable size I a foating point variable product iv. a double variable sales Tax10 v. a foating point variable TotalSum vwith initialization 5.0

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
b) Write a full program by apply the following decision table using nested if statement.
Assume that the grade point average is within the range 0.0 through 4.0.
Grade Point Average
Transcript Message
Failed semester - registration suspended
On probation for next semester
0.0-0.99
1.0- 1.99
2.0-2.99
3.0- 3.49
3.5- 4.00
(no message)
Dean's list for semester
Highest honours for semester
c) What will be printed by this carelessly constructed switch statement if the value of
colour is 'R'?
Switch (sieA)
break statement missing
case 'R:
SRAS. <« "red\n":
case 'B
SRAE. << "blue\n";
case 'Y:
SRAS. << "yellov\n":}
Question 5
a) List THREE (3) examples of real-world objects. For each object, list several attributes
and behaviors
b) Create a Student class that have two data members id (assign to your ID)
and name (assign to your name). Create the object of the Student class by
new keyword and printing the objects value. You may name your object as
Student1. The output should be like this:
Transcribed Image Text:b) Write a full program by apply the following decision table using nested if statement. Assume that the grade point average is within the range 0.0 through 4.0. Grade Point Average Transcript Message Failed semester - registration suspended On probation for next semester 0.0-0.99 1.0- 1.99 2.0-2.99 3.0- 3.49 3.5- 4.00 (no message) Dean's list for semester Highest honours for semester c) What will be printed by this carelessly constructed switch statement if the value of colour is 'R'? Switch (sieA) break statement missing case 'R: SRAS. <« "red\n": case 'B SRAE. << "blue\n"; case 'Y: SRAS. << "yellov\n":} Question 5 a) List THREE (3) examples of real-world objects. For each object, list several attributes and behaviors b) Create a Student class that have two data members id (assign to your ID) and name (assign to your name). Create the object of the Student class by new keyword and printing the objects value. You may name your object as Student1. The output should be like this:
b) Write a FULL Java program by using two for loops to produce the output shown below:
Question 1
a) Write a program that reads in the radius and length of a cylinder and computes
volume using the following formulas:
area = radius * radius * PI
volume = area " length
***
Write the variable definitions for each of the following:
i.
a character variable named Label
ii.
an integer variable size
c) Write a program that output the following using loops.
ii.
a finating point variable product
iv.
a double variable sales Tax10
valus of x : 19
valus of x : 18
value of x : 17
valus of x : 15
value of w I 15
value of x: 14
value of x : 13
valus of x : 12
value of x : 11
valua of x:
a floating point variable TotalSum with initialization 5.6
V.
Question 2
a) Write a complete program using function/Method named Average to calculate of four
numbers entered by user (treat the four variables as local in main). Read the four
numbers in main function and send them as parameter to the function Average. (Marks
are allocated to function prototype, function call and function definition).
b) Ifx= 2222 what is the value of each of the following expressions ?
Question 4
i.
x % 10
a) What is the output of the following (when embedded in a complete program)?
ii.
x/ 10
i.
ii.
(x/ 10) % 10
if (12<12)
cout << "Never":
iv.
x/ 100
else
V.
(x/ 100) % 10
cout << "Alwavs":
int n = 5:
Question 3
vhile (--n > 0)
a) Write only a partial program for function called max[). This function takes two
if (n ==2)
parameters num1 and num2 and returns the maximum between the two.
break:
cout<<n<<"";
}
cout<<"End of Loop. ";
Page 2 of 5
Page s of 6
Transcribed Image Text:b) Write a FULL Java program by using two for loops to produce the output shown below: Question 1 a) Write a program that reads in the radius and length of a cylinder and computes volume using the following formulas: area = radius * radius * PI volume = area " length *** Write the variable definitions for each of the following: i. a character variable named Label ii. an integer variable size c) Write a program that output the following using loops. ii. a finating point variable product iv. a double variable sales Tax10 valus of x : 19 valus of x : 18 value of x : 17 valus of x : 15 value of w I 15 value of x: 14 value of x : 13 valus of x : 12 value of x : 11 valua of x: a floating point variable TotalSum with initialization 5.6 V. Question 2 a) Write a complete program using function/Method named Average to calculate of four numbers entered by user (treat the four variables as local in main). Read the four numbers in main function and send them as parameter to the function Average. (Marks are allocated to function prototype, function call and function definition). b) Ifx= 2222 what is the value of each of the following expressions ? Question 4 i. x % 10 a) What is the output of the following (when embedded in a complete program)? ii. x/ 10 i. ii. (x/ 10) % 10 if (12<12) cout << "Never": iv. x/ 100 else V. (x/ 100) % 10 cout << "Alwavs": int n = 5: Question 3 vhile (--n > 0) a) Write only a partial program for function called max[). This function takes two if (n ==2) parameters num1 and num2 and returns the maximum between the two. break: cout<<n<<""; } cout<<"End of Loop. "; Page 2 of 5 Page s of 6
Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Datatypes
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
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