
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question

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:

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

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 4 steps with 1 images

Knowledge Booster
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
- Write a flowchart and C code for a program that does the following: Declare an array that will store 9 values Use a for() statement to store user entered scores for all 9- holes Create a function and pass the array into the definition of the function to compute the total Use an accumulating total statement to compute the total score Display the overall total to the output screen so that the golfer can see if he won.arrow_forwardprint() can have at most 2 items separated by a comma within its parentheses TrueFalse Once set in a program, a variable's value cannot change later during the program's run. TrueFalsearrow_forwardProgram Unit Score Calculator Console App Write a Python Console Application program that allows the user to enter the marks for different assessments in a unit, and computes the total mark and grade for the unit. Here is the program logic specification: There are six assessment activities Quiz1, Quiz2, Quiz3, Quiz4, Lab Journal, Major Assignment and Final Exam. The four quizzes are worth 5 marks each, the Lab Journal is worth 10 marks, the Major Assignment is worth 30 marks and the Final Exam is worth 40 marks. The algorithm for computing the total mark for the unit is: Total Mark = Quiz1+Quiz2+Quiz3+Quiz4+Major Assignment+ Lab Journal + Final Exam The following screenshot shows a successful test run:arrow_forward
- PART I: Functions – Math Test Write the Flowchart and Python code for the following programming problem based on the pseudocode below. Write a program that will allow a student to enter their name and then ask them to solve 10 mathematical equations. The program should display two random numbers that are to be added, such as: 247 + 129 The program should allow the student to enter the answer. The program should then display whether the answer was right or wrong, and accumulate the correct values. After the 10 questions are asked, calculate the average correct. Then display the student name, the number correct, and the average correct in both decimal and percentage format. In addition to any system functions you may use, you might consider the following functions: A function that allows the student to enter their name. A function that gets two random numbers, anywhere from 1 to 500. A function that displays the equation and asks the user to enter their answer. A function that…arrow_forwardTransient PopulationPopulations are affected by the birth and death rate, as well as the number of people who move in and out each year. The birth rate is the percentage increase of the population due to births and the death rate is the percentage decrease of the population due to deaths. Write a program that displays the size of a population for any number of years. The program should ask for the following data: The starting size of a population P The annual birth rate (as a percentage of the population expressed as a fraction in decimal form)B The annual death rate (as a percentage of the population expressed as a fraction in decimal form)D The average annual number of people who have arrived A The average annual number of people who have moved away M The number of years to display nYears Write a function that calculates the size of the population after a year. To calculate the new population after one year, this function should use the formulaN = P + BP - DP + A - Mwhere N is the…arrow_forwardThe code is not printing the correct result. Please explain to me step by step.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

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)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education