Java: An Introduction to Problem Solving and Programming (7th Edition)
7th Edition
ISBN: 9780133766264
Author: Walter Savitch
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 12, Problem 15PP
Program Plan Intro
Display student class details “HashMap” and “ArrayList”
Program Plan:
- Import required package.
- Define “StudentIDsListTest” class.
- Define main function.
- Create hashmap for student ID and course number.
- Create an object for scanner class.
- Declare required variables.
- Display prompt statement.
- Performs “do-while” loop. This loop will execute until “studID” is not equal to “-1”.
- Read student ID from user.
- If student ID is not equal to “-1”, then read course number from user.
- If the student ID is contains in “students” list, then
- Create array list named “class_List”.
- Add the course number to “class_List” using “add” method.
- Map the student ID to course number using “put” method.
- Otherwise,
- Create array list named “class_List”.
- If the course number is not in the class list, then add the given course number to “class_List” using “add” method.
- Display all the classes for each student using “for” loop.
- Create array list named “stud_List”.
- Display course number for corresponding student ID.
- Define main function.
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
Programming in C#:
Write a console-based application that displays every perfect number from 1 through 10000. A number is perfect if it equals the sum of all the smaller positive integers that divide evenly into it. For example, 6 is perfect because 1, 2, and 3 divide evenly into it and their sum is 6. Use format strings(field size 8, right alignment) to show all perfect numbers. Display the results as seen below.
6
28
496
8128
IN JS PROGRAMMING LANGUAGE
Your local bank has decided to upgrade its ATM machines by incorporating motion sensor
technology. The machines now interpret a series of consecutive dance moves in place of a
PIN number.
Create a program that converts a customer's PIN number to its dance equivalent. There is
one dance move per digit in the PIN number. A list of dance moves is given in the code.
Examples
danceConvert("0000")
danceConvert("3856")
["Shimmy", "Shake", "Pirouette", "Slide"]
→ ["Slide", "Arabesque", "Pop", "Arabesque" ]
-
In C Programming Language
Palindrome: “A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward or forward, such as ‘madam’ or ‘kayak’” (excerpt from Wikipedia).Write a program that reads 8 words from Palindrome.txt and checks whether the word you read is a palindrome (please read its description above) or not. Print the index numbers of all the palindrome words in your array. You are required to read words character by character into a character array.• Write readFile function, which gets a file pointer and a two-dim array, to read each word(bunch of characters) line by line and store them into a two-dim character array.• Write findSize function takes a one-dim array and returns its actual size.• Write isPalindrome function takes a one-dim character array to check whether the content is a polindrome or not. If the word (character squence) is a palindrome, then it returns 1. Otherwise, it returns 0.
Chapter 12 Solutions
Java: An Introduction to Problem Solving and Programming (7th Edition)
Ch. 12.1 - Suppose aList is an object of the class...Ch. 12.1 - Prob. 2STQCh. 12.1 - Prob. 3STQCh. 12.1 - Prob. 4STQCh. 12.1 - Can you use the method add to insert an element at...Ch. 12.1 - Prob. 6STQCh. 12.1 - Prob. 7STQCh. 12.1 - If you create a list using the statement...Ch. 12.1 - Prob. 9STQCh. 12.1 - Prob. 11STQ
Ch. 12.1 - Prob. 12STQCh. 12.2 - Prob. 13STQCh. 12.2 - Prob. 14STQCh. 12.2 - Prob. 15STQCh. 12.2 - Prob. 16STQCh. 12.3 - Prob. 17STQCh. 12.3 - Prob. 18STQCh. 12.3 - Prob. 19STQCh. 12.3 - Write a definition of a method isEmpty for the...Ch. 12.3 - Prob. 21STQCh. 12.3 - Prob. 22STQCh. 12.3 - Prob. 23STQCh. 12.3 - Prob. 24STQCh. 12.3 - Redefine the method getDataAtCurrent in...Ch. 12.3 - Repeat Question 25 for the method...Ch. 12.3 - Repeat Question 25 for the method...Ch. 12.3 - Repeat Question 25 for the method...Ch. 12.4 - Revise the definition of the class ListNode in...Ch. 12.4 - Prob. 30STQCh. 12 - Repeat Exercise 2 in Chapter 7, but use an...Ch. 12 - Prob. 2ECh. 12 - Prob. 3ECh. 12 - Repeat Exercises 6 and 7 in Chapter 7, but use an...Ch. 12 - Write a static method removeDuplicates...Ch. 12 - Write a static method...Ch. 12 - Write a program that will read sentences from a...Ch. 12 - Repeat Exercise 12 in Chapter 7, but use an...Ch. 12 - Write a program that will read a text file that...Ch. 12 - Revise the class StringLinkedList in Listing 12.5...Ch. 12 - Prob. 12ECh. 12 - Write some code that will use an iterator to...Ch. 12 - Prob. 14ECh. 12 - Write some code that will use an iterator to...Ch. 12 - Prob. 17ECh. 12 - Revise the method selectionSort within the class...Ch. 12 - Repeat the previous practice program, but instead...Ch. 12 - Repeat Practice Program 1, but instead write a...Ch. 12 - Write a program that allows the user to enter an...Ch. 12 - Write a program that uses a HashMap to compute a...Ch. 12 - Write a program that creates Pet objects from data...Ch. 12 - Repeat the previous programming project, but sort...Ch. 12 - Repeat the previous programming project, but read...Ch. 12 - Prob. 9PPCh. 12 - Prob. 10PPCh. 12 - Prob. 11PPCh. 12 - Prob. 12PPCh. 12 - Prob. 13PPCh. 12 - Prob. 14PPCh. 12 - Prob. 15PP
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
- Given the code that reads a list of integers, complete the number_guess() function, which should choose a random number between 1 and 100 by calling random.randint() and then output if the guessed number is too low, too high, or correct. Import the random module to use the random.seed() and random.randint() functions. • random.seed(seed value) seeds the random number generator using the given seed value. • random.randint(a, b) returns a random number between a and b (inclusive). For testing purposes, use the seed value 900, which will cause the computer to choose the same random number every time the program runs.arrow_forwardA contact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. Write a program that first takes in word pairs that consist of a name and a phone number (both strings). That list is followed by a name, and your program should output the phone number associated with that name. Ex: If the input is: Joe 123-5432 Linda 983-4123 Frank 867-5309 Frank the output is: 867-5309 LAB 6.21.1: LAB: Contact list 0/ 10 ACTIVITY main.py Load default template... 1 user_input = input() 2 entries = user_input.split() 3 contact_list = dict(pair. split(':') for pair in entries)arrow_forwardAssignment 5A: Multiple Frequencies. In the last assignment, we calculated the frequency of a coin flip. This required us to have two separate variables, which we used to record the number of heads and tails. Now that we know about arrays, we can track the frequency of all numbers in a randomly generated sequence. For this program, you will ask the user to provide a range of values (from 1 to that number, inclusive) and how long of a number sequence you want to generate using that number range. You will then generate and save the sequence in an array. After that, you will count the number of times each number occurs in the sequence, and print the frequency of each number. Hints: You can use multiple arrays for this assignment. One array should hold the number sequence, and another could keep track of the frequencies of each number. Sample Output #1: What's the highest number you want to generate?: 5 How Long of a number sequence do you want to generate?: 10 Okay, we'll generate 10…arrow_forward
- The mean of a list of numbers is its arithmetic average. The median of a list is its middle value when the values are placed in order. For example, if an ordered list contains 1, 2, 3, 4, 5, 6, 10, 11, and 12, then the mean is 6, and their median is 5. Write an application that allows you to enter nine integers and displays the values, their mean, and their median.arrow_forwardC++ Language Write a program that prints a custom conversion table from Celsius temperatures to Fahrenheit and Newton (Links to an external site.) temperatures. The formula for the conversion from Celsius to Fahrenheit is : F=9/5*C+32 F is the Fahrenheit temperature, and C is the Celsius temperature. The formula for the conversion from Celsius to Newton is C = 100/33*N N is the Newton Temperature and C is the Celsius temperature Your program should prompt the user for a lower value and upper value for a range of temperatures in Celsius. It should then prompt the user for the amount they want to increment by. Then use a loop to output to a file named conversion_table.txt a table of the Celsius temperatures and their Fahrenheit and Newton equivalents within the range of values using the increment given by the user. Make sure to format your output to 2 decimal places. INPUT VALIDATION: Ensure the second number is greater than the first number, and make sure the increment is greater…arrow_forwardIn computational geometry, often you need to find the rightmost lowest point in a set of points. Write the following function that returns the rightmost lowest point in a set of points:# Return a list of two values for a pointdef getRightmostLowestPoint(points):Write a test program that prompts the user to enter the coordinates of six points and displays the rightmost lowest point.arrow_forward
- 3. Randomly generate a number in range [1, 12]. Map this number to a season: if the number is 3, 4, or 5, map it to “Spring", if the number is 6, 7, or 8, map it to "Summer", if the number is 9, 10, or 11, map it to "Fall", and if the number 12, 1, or 2, map it to "Winter". Display season namearrow_forwardHow would I go about programming this code?arrow_forwardIn C# language using Microsoft Visual Studio in Windows Forms App (.NET Framework) A slot machine is a gambling device that the user inserts money into and then pulls a lever (or presses a button). The slot machine then displays a set of random images. If two or more of the images match, the user wins an amount of money, which the slot machine dispenses back to the user. Design a program that simulates a slot machine. When the program runs, it should do the following: Ask the user to enter the amount of money he or she wants to insert into the slot machine. Create an application that simulates a slot machine. The application should let the user enter into a TextBox the amount of money he or she is inserting into the machine. When the user clicks the Spin button, the application should display three randomly selected symbols. (Slot machines traditionally display fruit symbols.arrow_forward
- CS102 Programming language is C++.arrow_forwardpython programing: You are going to create a race class, and inside that class it has a list of entrants to the race. You are going to create the daily schedule of three or so races and populate the races with the jockey/horse entries and then print out the schedule. Create a race class that has The name of the race as a character string, ie “RACE 1” or “RACE 2”, The time of the race A list of entries for that race Create a list of of 3 (or 4) of those race objects(races) for the day For the list of entries for a particular race, make a entrant class (the building block of your entrants list) you should have The horse name The jockey name Now you need to Populate the structure (ie set up three races on the schedule, add 2-3 horses entries to each race. You can hardcode the entries if you want to, rather than getting them from the user, just to save the time of making a menu interface and whatnot. Be able to print the days schedule So example output would be…arrow_forwardCommon Time Zones Function Name: commonTimeZones() Parameters: code1( str ), code2( str) Returns: list of common time zones ( list ) Description: You and your friend live in different countries, but you figure there's a chance that both of you might be in the same time zone. Thus, you want to find out the list of possible time zones that you and your friend could both be in. Given two country codes, write a function that returns a list of the time zones the two countries have in common. Be sure not to include any duplicate time zones. If the two country codes do not have any common time zones, return the string 'No Common Time Zones' instead. Note: You can assume that the codes will always be valid. example test cases: >>> commonTimeZones('can', 'usa') [UTC-08:00', 'UTC-07:00', 'UTC-06:00', 'UTC-05:00', 'UTC-04:00] >>> commonTimeZones('rus', 'chn') [UTC+08:00] For this assignment, use the REST countries API (https://restcountries.com/#api-endpoints-v2). For all of your requests, make…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT