Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
11th Edition
ISBN: 9780134670942
Author: Y. Daniel Liang
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 8.5, Problem 8.5.1CP
Program Plan Intro
Given code in “Listing 8.2”:
The given code in “Listing 8.2” is to compare each student’s answers with the key and count the number of correct answers.
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
How do you change the code such that it also shows the highest count as well as the student with the highest count?
The following Code should read the first and the second number of the student ID then
print the sum and divide it by zero if possible. However, there are three errors in the
code. Find each error and specify its type (syntax, runtime, or logic) and correct them
in the bellow table. Then, write the code after you correct all errors and provide
screenshot of the output.
Note:
1. The correct code should be tested using your first two numbers of your student ID.
2. 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.
import
public class Main {
public static void main(String[] Strings) {
Scanner input = new Scanner(System.in);
System.out.println("Enter the first number of your student ID: ");
int number1=input.nextInt();
java.util.Scanner;
Systm.out.println("Enter the second number of your student ID: ");
int number2 =input.nextInt();
System.out.println("The…
Implement the "Remove song" function. Prompt the user for the unique ID of the song to be removed.Ex:
REMOVE SONG
Enter song's unique ID: JJ234
"All For You" removed
Chapter 8 Solutions
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Ch. 8.2 - Declare an array reference variable for a...Ch. 8.2 - Prob. 8.2.2CPCh. 8.2 - What is the output of the following code? int[] []...Ch. 8.2 - Which of the following statements are valid? int...Ch. 8.3 - Show the output of the following code: int[][]...Ch. 8.3 - Show the output of the following code: int[][]...Ch. 8.4 - Show the output of the following code: public...Ch. 8.5 - Prob. 8.5.1CPCh. 8.6 - What happens if the input has only one point?Ch. 8.7 - What happens if the code in line 51 in Listing 8.4...
Ch. 8.8 - Declare an array variable for a three-dimensional...Ch. 8.8 - Assume char[][][] x =new char[12][5][2], how many...Ch. 8.8 - Show the output of the following code: int[][][]...Ch. 8 - (Sum elements column by column) Write a method...Ch. 8 - (Sum the major diagonal in a matrix) Write a...Ch. 8 - (Sort students on grades) Rewrite Listing 8.2,...Ch. 8 - (Compute the weekly hours for each employee)...Ch. 8 - (Algebra: add two matrices) Write a method to add...Ch. 8 - (Algebra: multiply two matrices) Write a method to...Ch. 8 - (Points nearest to each other) Listing 8.3 gives a...Ch. 8 - (All closest pairs of points) Revise Listing 8.3,...Ch. 8 - Prob. 8.9PECh. 8 - (Largest row and column) Write a program that...Ch. 8 - (Game: nine heads and tails) Nine coins are placed...Ch. 8 - (Financial application: compute tax) Rewrite...Ch. 8 - (Locate the largest element) Write the following...Ch. 8 - (Explore matrix) Write a program that prompts the...Ch. 8 - (Geometry: same line ?) Programming Exercise 6.39...Ch. 8 - (Sort two-dimensional array) Write a method to...Ch. 8 - (Financial tsunami) Banks lend money to each...Ch. 8 - (Shuffle rows) Write a method that shuffles the...Ch. 8 - (Pattern recognition: four consecutive equal...Ch. 8 - Prob. 8.20PECh. 8 - (Central city) Given a set of cities, the central...Ch. 8 - (Even number of 1s) Write a program that generates...Ch. 8 - (Game: find the flipped cell) Suppose you are...Ch. 8 - (Check Sudoku solution) Listing 8.4 checks whether...Ch. 8 - Prob. 8.25PECh. 8 - (Row sorting) Implement the following method to...Ch. 8 - (Column sorting) Implement the following method to...Ch. 8 - (Strictly identical arrays) The two-dimensional...Ch. 8 - (Identical arrays) The two-dimensional arrays m1...Ch. 8 - (Algebra: solve linear equations) Write a method...Ch. 8 - (Geometry: intersecting point) Write a method that...Ch. 8 - (Geometry: area of a triangle) Write a method that...Ch. 8 - (Geometry: polygon subareas) A convex four-vertex...Ch. 8 - (Geometry: rightmost lowest point) In...Ch. 8 - (Largest block) Given a square matrix with the...Ch. 8 - (Latin square) A Latin square is an n-by-n array...Ch. 8 - (Guess the capitals) Write a program that...
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
- Need help fixing the code with many attempts. I need help with the \n under "Welcome to myrand"and fix the chart that matches perfectly with the assignment entering 5 and producing 100.please use my code to make changes so I can have a better understanding!arrow_forwardThis code is incorrect. It does not match the output pictured in the original question. Please update the code to produce the exact output that is in the picturearrow_forwardA company accepts user orders for its products interactively. Users might make the following errors as they enter data: The item number ordered is not numeric, too low (less than 0), or too high (more than 9999). The quantity is not numeric, too low (less than 1), or too high (more than 12). The item number is not a currently valid item. The company’s current inventory consists of the following items listed in Table: item number price 111 0.89 222 1.47 333 2.43 444 5.99 Create a class that stores an array of usable error messages; save the file as OrderMessages.java. Create your own OrderException class that stores one of the messages; save the file as OrderException.java. Create an application that contains prompts for an item number and quantity. Allow for the possibility of nonnumeric entries as well as…arrow_forward
- In the following procedure, the parameter age represents a person's age. The procedure is intended to return the name of the age group associated with age. People who are under 18 are considered minors, people who are 65 and older are considered senior citizens, and all other people are considered adults. The procedure does not work as intended. Line 1: PROCEDURE ageGroup(age) Line 2: } result "adult" Line 3: Line 4: IF(age 65) Line 5: { Line 6: result "senior citizen" Line 7: Line 8: RETURN(result) Line 9: Line 10: result "adult" Line 11: IF(age < 18) Line 12: Line 13: result "minor" Line 14: Line 15: RETURN(result) Line 16: } ill cause the procedure to work as intended?arrow_forwardHomework Instructions: For each Exercise below, write your code in an IDE and run your code within the IDE as well. Once you have satisfied the Exercise requirements, paste your code below under the corresponding Exercise. Exercise 1: Dogs mature at a faster rate than human beings. If you own a dog, you might've heard this rule: one year for Snoopy equals seven years for you. Turns out, the math isn't that simple. Dogs mature more quickly than we do early on. Here's how we can convert your dog's age into human years. The first two years of a dog's life count as 21 human years. ● Each following year counts as 4 human years. So, a one-year-old dog is 10.5 years old in human years, and a two-year-old dog is 21 years old in human years. How to write a C++ program called dog_years.cpp to calculate the age, in human years, of any dog older than 2. Exercise 2: The Pythagorean Theorem states that the hypotenuse (c) is the sum of the squares of the other two sides (a and b). This can be written…arrow_forwardYou want to execute a block of code only if age equals 65. Which of these versions would be thecorrect syntax? (Note: The { ... } indicates the block of code enclosed in braces.)arrow_forward
- Show how you would use the colon operator to create the following array in Octave: -7 -4 -1 2 5 8arrow_forwardUsing python code if the user won or lost the round of hangman. It should also prompt the user if they want to play another round of hangman.arrow_forwardYou have an ID number containing from 8 digits. How many IDs get the number “5” as their second or third digit?arrow_forward
- Finding the maximum value in a BST. Students need to write the code.arrow_forwarddeclare variables, include your arrays. Declare two struct variables to hold data. The first will be the TravelerInfo struct, which holds name(string), weight(double), newWeight(double) for the weight on the other planet, planetChoice ( int) and speed(int). The second struct is the TravelTimeCalc struct. It holds total travel time, years, days, and hours. All are ints. Both structs are declared in the Functions.h file. Write out a program title and brief introduction using your Header function. Pass the arrays to the FillPlanetInfo function, which will load the data into the three arrays. Start a do while loop in main as your Play loop. Pass the function AskSpaceTravellerInfo a reference to the TravelerInfo struct variable and the array of planet names. Get the user’s name, Earth weight, the speed they want to travel and the planet they wish to visit. You will need to provide a menu with the planet names and a way for the user to select the chosen destination. Pass the…arrow_forwardQoS please.creates array of 10 integers. Ask the user to enter the data in the array. Each time the data entered in the array should be unique. Your program should not allow the user to enter the duplicate values in the array. After feeding data into the array created, create another array of the 10 integers and save the data of 1st array in the reverse order into the second array. For Example Array 1 1 2 3 4 5 6 7 8 9 10 Array 2 10 9 8 7 6 5 4 3 2 1 .arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningNew Perspectives on HTML5, CSS3, and JavaScriptComputer ScienceISBN:9781305503922Author:Patrick M. CareyPublisher:Cengage Learning
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningNp Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:CengageCOMPREHENSIVE MICROSOFT OFFICE 365 EXCEComputer ScienceISBN:9780357392676Author:FREUND, StevenPublisher:CENGAGE L
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:9780357392676
Author:FREUND, Steven
Publisher:CENGAGE L