
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:DATA: You will be judged on the quality of your data.
Type in a total of at least 8 sets of data values.
Have at least two sets where the sum is less than 1.
Have at least two sets where the sum is more than 10.
Have at least four sets where you do print your name one or more times.
Be sure to include both 1 and 10 as valid sets.
STYLE: Be sure that each method has a good comment explaining two things: exactly
what parameter(s) the method will receive, and exactly what the method will do–for
example, if it returns an answer or prints. For each method, mention the method's
parameters by name in the comment.
OUTPUT: Here is some sample output (ignoring the introduction):
the three original integers are -5, 3, -5
the sum is -2
it is not possible to print the name in this case
there is/are 0 even number(s)
the three original integers are 4, -1, -3
the sum is 3
your name
your name
(your name printed 3 times)
your name
there is/are 1 even number(s)

Transcribed Image Text:CIS 1115
Assignment 3
Spring 2021
Write a complete Java program, including comments in both the main program and in
each method, which will do the following:
0. The main program will start by calling a method named introduction() which will print
out a description of what the program will do at the top of the first output page. This first
method is called just once.
This method will not be sent any parameters, and it will not return a value. It will print
several lines of output explaining what the program does, and it will explain how the
program should end (see step 4).
1. The main program will ask the user to type in three integer values, positive, negative,
or zero (see step 4). The main program will print the three numbers right after they are
read in.
2. The main program will call a method named findsum(), sending it the three integer
values. The method will determine the sum of the larger 2 of the three values, sending
the answer back to the main program.
The main program will print the value returned. For example, if you send 4 6 2 to the
method, the method will return 10, (4+6) and the main program will print that 10 is the
sum.
3. The main program will call a method named printmyname(), sending it one
parameter - the sum of the integer values calculated in step 2. The method will print
your name that many times, and the method will not return a value. (Be careful - see
below.)
For example, if the parameter to the method is 2, then the method should print your name
2 times. if the parameter is 4, the method should print your name 4 times.
However, if the parameter sent in is less than or equal to 0, or if the parameter sent in
is greater than 10, the method will say it is not possible to print the name. |For example, if
the parameter is -2, the method will say in this case it is not possible to print the name. If
the parameter is 12, the method will say it is not possible to print the name.
4. The main program will call a method named howmanyeven, sending it all three
integers. The method will determine how many (0,1,2,0or 3) of the values are even and
return that value to the main program. (Hint: Even means divisible by 2 with no
remainder, and there is an operator that will tell you the remainder.)
The main program will print an appropriate message: There is/are_ even number(s).
5. Then the main program will skip a few lines and go back to step 1 (not step 0).
At step 1, if the user types in a special combination, the program will go to step 5.
You must determine what this combination is, and you must explain it-in a prompt or in a
comment, and in the introduction at the beginning-to the person using the program.
6. At the end, print how many sets of three data values were entered and processed.
Make sure that this value is at least 8.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 2 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 java code for a calculator that calculates the Sum and Product of 2 numbers Program requirements: 1. Documentation 2. Write a method named userinput that asks users to input 2 integer numbers. >>Hint: Method with no parameters that returns 2 values. 3. Write a method named Calculator that calculates the Sum and Product of 2 numbers ->Hint: Method with 2 parameters that returns 2 values. 4. Write a method name Display that displays the Sum and Product of the 2 numbers >>Hint: Method with 2 parameters and no returns (void). 5. Use a do-while loop and ask the user to continue or not. 6. Your program output format must be exactly the following: ->Note: Include the output in your program. =>> Calculator Enter the first number: 100 Enter the second number: 200 Sum = 300 Product = 20000 Enter any number to continue or 0 to exit: 8 =>> Calculator Enter the first number: 6 Enter the second number: 9 Sum = 15 Product = 54 Enter any number to continue or 0 to exit: 0 ++++ End of the program…arrow_forwardIn java pleasearrow_forwardI need help with creating a Java program based with the loop methods:arrow_forward
- Computer programming. Java.arrow_forwardOutput the numbers 1-100 inclusive starting with 1. Please a comma and a space after each number except the last. Output a new line after the last number. Write a code in Java that results like test case 1arrow_forwardWrite a java program which asks the user to enter name and age and calls the following methods: a. printName(): Takes name as parameter and prints it 20 times using a while loop. b. printAge(): Takes age as parameter and prints all the numbers from 1 up to age. Please strictly follow this format. Note: any extra or missing space / line will lead to test failure. Name: Andy Age: 10 Andy Andy Andy Andy Andy Andy Andy Andy Andy Andy Andy Andy Andy Andy Andy Andy Andy Andy Andy Andy 1,2,3,4,5,6,7,8,9,10 class Main {public static void main(String[] args) {}}arrow_forward
- Java. See the attached image for the task.arrow_forward1. Write a program in Java that should do the following:a. Prompt the user to enter 3 grades (assume the grades are integer numbers)b. Compute the average of the 3 grades by calling a method, named average()c. Print the resulting average as a formatted output limiting to 2 decimal places.The average() method will:a. take 3 integer values as the input parameters,b. calculate the average of the three integers,c. return the average.Sample output (assuming the three grades are 89, 93, and 72):The average is 84.67arrow_forwardWrite a simple Java program to calculate the average daily temperature from the given daily temperatures for a week and then the high temperature for the week. The program then calculates the number of days the temperature is above average. Be sure to include the following: A class header with a class named Temperature. A main method. Declare the week’s temperature as an array of type double (in a single line) and name the array as temp. Initialize the array with: 80, 85, 86.7, 90, 87, 95, 98 Declare and initialize any other necessary variables. Use appropriate loop statement. Display all the output appropriately. Use System.out.println to do all the printing in this program. Be sure to import the appropriate package for the Scanner class in your program. Your program must be syntactically correct and ready to run.arrow_forward
- Write a program called LoopMethod (main method) that contains a method called printNums (method name) that prints the numbers from a specified start to end value. a) The main method will do the following: • asks the user for start and end number (int type). • calls the printNums methodb) The printNums method will do the following: • receives start and end number (parameters)• prints from the start to the end number using a loop Sample Run: Input start number: 3Input end number: 93 4 5 6 7 8 9Input start number: 9Input end number: 219 10 11 12 13 14 15 16 17 18 19 20 21arrow_forwardWrite a complete Java program that does the following: 1. Ask the user to enter the last number and the second last number of his / her student ID. 2. Stores the entered numbers in adequate variables. 3. Finds and prints the following using "printf": The sum of the two numbers. The boolean value of comparing the equality of the two numbers using the equality operator. The value of the first number is raised to the power of the second number using a method from the class Math. Note: The class name of your Java program must be your first name. Your answer should have the code as text as well as the screenshot of the program output (using your own student ID) as a part of your answer. Otherwise, zero marks will be awarded. A typical run of the program Compile Messages JGRASP Messages Run 1/0 Interactions End Clear Help GRASP x Java Question 2 Enter the last amber of your student ID Enter the second last number of your student ID 2 The sum of 5+2=7 (5 is equal to 2) false 3 to the power of…arrow_forwardWrite a program using java programing language. Write a Java class (called ShowNum) that displays the same number of asterisks (row and columns) as is input in 2 numbers. Your class should have a default constructor (number1 is 0, number2 is 0) and another constructor that inputs 2 numbers (integers). You'll need accessor methods for the numbers and a display method that displays as follows: Input: 2, 7 ******* ******* Demo the class in a client (called ShowNumClient) that allows the user to run the program as many times as they want (enter number and use display method). The user will signal with a sentinel (-1), when they want to terminate the client. Make sure that each number entered in the client is between 1 and 30.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
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