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
Complete the attached
Do not change anything in the main method. Just define two methods, the input method and the average method, as described in the comments in the attached file.
Sample run:
Enter a grade, negative to quit: 97
Enter a grade, negative to quit: 95
Enter a grade, negative to quit: 96
Enter a grade, negative to quit: 57
Enter a grade, negative to quit: 91
Enter a grade, negative to quit: -1
97.0, 95.0, 96.0, 57.0, 91.0
Your average is 87.2
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 3 steps with 3 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
- For this, we are to write another method, but this time the method returns a value. add Create a method called add that takes two integers as parameters. return the numbers added together. main Inside of main, ask the user for two numbers. Call the add method with the numbers and store the result in a variable. Print the result. Your program should prompt the user with the following. Enter a number: Enter another number: Below is sample input to test your program. 5 3 Your program should output the following 8 Code Skeleton: import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); /* Type your code here. */ }}arrow_forwardpython-Exercise 1 Write a python program to display the greater number between 2 numbers. The numbers are given by user. Input : 17 -6 Output: The greatest number is 17 2.Use a class and add a method called greatestNumberarrow_forwardIn this assignment you will demonstrate your knowledge of debugging by fixing the errors you find in the program below. Fix the code, and paste it in this document, along with the list of the problems you fixed.This example allows the user to display the string for the day of the week. For example, if the user passed the integer 1, the method will return the string Sunday. If the user passed the integer 2, the method will return Monday. This code has both syntax errors and logic errors. Hint: There are two logic errors to find and fix (in addition to the syntax errors).Inport daysAndDates.DaysOfWeek;public class TestDaysOfWeek {public static void main(String[] args) {System.out.println("Days Of week: ");for (int i = 0;i < 8;i++) {System.out.println("Number: " + i + "\tDay Of Week: " + DaysOfWeek.DayOfWeekStr(i) )}}}package daysAndDatespublic class DaysOfWeek {public static String DayOfWeekStr(int NumberOfDay) {String dayStr = ""switch (NumberOfDay) {case 1:dayStr =…arrow_forward
- USING JAVA Create a method that randomly select a letter in the alphabet (the random should be in another method including the main method )arrow_forwardWrite 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 program that asks the user to enter their name and a letter. The program should then use this information to output the string “<your name> guessed the letter <lowercase letter>”, where <your name> is the name entered by the user and <lowercaseletter> is the lowercase form of the letter entered by the user.tip: make use of the method .lower() Example:Enter your name: Jane DoeGuess a letter: AJane Doe guessed the letter aarrow_forward
- Use the left to right addition method as outlined in the module to add the numbers. For the middle row of answers, if the number above needs an underline, type in an underline (_). Otherwise leave it blank. Show all work using the correct method on your handwritten work/answer sheet. 9818 + 3871arrow_forwardCreate a variable containing the string “I hate Python” Turn it into a more positive string: “I love Python” using replace method and print the output Finally print out the middle letter of the new string using the len method (do not simply count the letters and print the letter without using the len() method!)arrow_forwardWe will rewrite the Sales Bar Chart question to use method for printing out the bar chart. The part where the asterisks are printed out should be done with a method. Use this method for each bar. The original question statement is here: Write a program that asks the user to enter today’s sales for five stores. The program should display a bar chart comparing each store’s sales. Create each bar in the bar chart by displaying a row of asterisks. Each asterisk should represent $100 of sales. Here is an example of the program’s output: Enter today's sales for store 1: 1000 [Enter] Enter today's sales for store 2: 1200 [Enter] Enter today's sales for store 3: 1800 [Enter] Enter today's sales for store 4: 800 [Enter] Enter today's sales for store 5: 1900 [Enter] SALES BAR CHART Store 1: ********** Store 2: ************ Store 3: ****************** Store 4: ******** Store 5: *******************arrow_forward
- Here are the original instructions for the code below that I wrote. Write a method that accepts a maximum number as an argument and prints each number from 1 up to that maximum, inclusive, enclosed in square brackets. I want to make the program prompt a max # input from a user and pass that value to the printNumbers methods and then print the max from the user input. Is this possible? import java.util.Scanner; public class PrintNumbers{Scanner input = new Scanner(System.in);public static void printNumbers(int max){for(int count = 1; count <= max; count++){System.out.print("[" +count+ "]");}}public static void main(String[] args){printNumbers(10);}}arrow_forwardWrtie TWO methods pass number of birds and print number of birds in California (method1) and birds in Texas (Method 1) Print the total of birds. You can use void method.arrow_forwardWrite a program called Loopmethod that contains a main method and a method called printNums that prints the numbers from a specified start to end value. A method must be used. Refer to the pic and please show your source code and console.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