Java Programming (MindTap Course List)
9th Edition
ISBN: 9781337397070
Author: Joyce Farrell
Publisher: Cengage Learning
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Chapter 4, Problem 17RQ
Program Description Answer
Java classes are stored in a “package”.
Hence, the correct answer is option “C”.
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
Define a Student class, with 3 data fields:
ID: string
Name: string
FavoriteThing: string
Create an application that stores and outputs a list of the students' favorite things. Suppose each student only has one favorite thing.
code Connect6State.java according to the following instructions
Class Connect6State
java.lang.Object
Connect6State
public class Connect6State extends java.lang.Object
Connect6State - A representation of a Connect6 (http://en.wikipedia.org/wiki/Connect6) game state. We assume a square grid board size specified to be a positive integer less than or equal to 26. Size 19 is common. The first and second players place pieces on the board that are black and white, respectively. Each piece is placed in an unoccupied grid position. On the first turn, the first player places one piece. Afterwards, players alternate placing two pieces per turn. Play continues until either one player completes a consecutive line of 6 or more of their pieces or no play is possible. The player with 6 or more pieces in a horizontal, vertical, or diagonal line is the winner. If no legal play is possible, the game is a draw.
Field Summary
Fields
Modifier and Type
Field
Description
static int…
1. Create a new Java class named Student that has the following fields
o yearOfAdmission - The yearOfAdmission field is an calendar data type that
holds the year of admitting the student (e.g. 2021)
o Name - The name field is a String object that holds the name of the student
(e.g. “Ahlam")
o Address – The address field is a String that holds the address of the student (e.g.
“AlHail”)
2. In addition to that, the student class should have the following methods.
o Constructor - The constructor should accept yearOfAdmission, name, and
Address as arguments
▪ These values should be used to initialize the year of admitting student,
name of the student, and Address fields.
o Getter Methods - Write three accessor (getter) methods to get the values stored
in an object's fields
▪ getYear(), getName(), get Address ()
Below code is a hint to get you started.
public class Student
{ private int yearOfRegistrn; private String Name; private String Address;
// Constructor public…
Chapter 4 Solutions
Java Programming (MindTap Course List)
Ch. 4 - Prob. 1RQCh. 4 - Prob. 2RQCh. 4 - Prob. 3RQCh. 4 - Prob. 4RQCh. 4 - Prob. 5RQCh. 4 - Prob. 6RQCh. 4 - Prob. 7RQCh. 4 - Prob. 8RQCh. 4 - Prob. 9RQCh. 4 - Prob. 10RQ
Ch. 4 - Prob. 11RQCh. 4 - Prob. 12RQCh. 4 - Prob. 13RQCh. 4 - Prob. 14RQCh. 4 - Prob. 15RQCh. 4 - Prob. 16RQCh. 4 - Prob. 17RQCh. 4 - Prob. 18RQCh. 4 - Prob. 19RQCh. 4 - Prob. 20RQCh. 4 - Prob. 1PECh. 4 - Prob. 2PECh. 4 - Prob. 3PECh. 4 - Prob. 4PECh. 4 - Prob. 5PECh. 4 - Prob. 6PECh. 4 - Prob. 7PECh. 4 - Prob. 8PECh. 4 - Prob. 9PECh. 4 - Prob. 10PECh. 4 - Prob. 11PECh. 4 - Prob. 1GZCh. 4 - Prob. 2GZ
Knowledge Booster
Similar questions
- Class OOPigjava.lang.Objectextended by OOPigpublic class OOPigextends java.lang.ObjectOOPig is the main console class for the Pig application. It is typically executed within a terminal (shell) window. Pig is a folk jeopardy dice game with simple rules: Two players race to reach 100 points. Each turn, a player repeatedly rolls a die until either a 1 ("pig") is rolled or the player holds and scores the sum of the rolls (i.e. the turn total). At any time during a player's turn, the player is faced with two decisions: roll - If the player rolls a1: the player scores nothing and it becomes the opponent's turn.2 - 6: the number is added to the player's turn total and the player's turn continues.hold - The turn total is added to the player's score and it becomes the opponent's turn. This is a text-based implementation of a game of Pig where the user plays against a "hold at 20 or goal" computer player that rolls until a 1 ("pig") is rolled, or the turn total is greater than or equal to 20,…arrow_forwardComputer Science You are required to develop a small chatting application where two or more friends can communicate each other through messages. Create a class Message which has Date d, and message (string). Provide getters/setters, constructors, toString. Create a class Friend having String name, String contact, email and ArrayList of Messages provide getters/setters, constructors, toString addMessage(Message m) method which will add new message to the list. Provide following options to the user using JFrame. Login which will help user login to the application. View Friends (Display List of All Friends) View Messages ( This should display all message of a Friend) Send message (This should ask for friend name and message match the friend name and write that message to the array list).arrow_forwardTo use any of the prewritten classes besides those in the java.lang package, you must___ a. use the entire path with the class name b. import the class c. import the package of which the class you are using is a part d. use any of these methodsarrow_forward
- Write a java programme create a text based user interface class called WorkOutUI Create tow fields that will be accessible through the whole class A static constant field called ABBA to store the string "Agnetha#Benny#Bjorn#annafrid". A static field called an integer called totalPoints. Code a method Called processWorkOuts.The method must accept the name of the member of Abba whose text file must be processed.This method must be called from the main method. In the processWorkOuts Method: Display the name of the Abba Group whose file is being processed. add ".txt" to the file name sent as a parameter. instantiate a WorkOut object called workOut Using the constructor:+constructor(p:real, n:interger) ,send 0 for an initial points value and 0 as the initial numWorkOuts value. Open the text file and loop through the file extracting the start ,end,description and level fields from the file.Display an error message if the file cannot open. a) Instantiate a workout object using the…arrow_forwardpython: class Student:def __init__(self, first, last, gpa):self.first = first # first nameself.last = last # last nameself.gpa = gpa # grade point average def get_gpa(self):return self.gpa def get_last(self):return self.last class Course:def __init__(self):self.roster = [] # list of Student objects def add_student(self, student):self.roster.append(student) def course_size(self):return len(self.roster) # Type your code here if __name__ == "__main__":course = Course()course.add_student(Student('Henry', 'Nguyen', 3.5))course.add_student(Student('Brenda', 'Stern', 2.0))course.add_student(Student('Lynda', 'Robison', 3.2))course.add_student(Student('Sonya', 'King', 3.9)) student = course.find_student_highest_gpa()print('Top student:', student.first, student.last, '( GPA:', student.gpa,')')arrow_forwardjava Jframe 6. Cell Phone PackagesCell Solutions, a cell phone provider, sells the following packages:300 minutes per month: $45.00 per month800 minutes per month: $65.00 per month1500 minutes per month: $99.00 per monthThe provider sells the following phones (a 6 percent sales tax applies to the sale of a phone):Model 100: $29.95Model 110: $49.95Model 200: $99.95Customers may also select the following options:Voice mail: $5.00 per monthText messaging: $10.00 per monthWrite an application that displays a menu system. The menu system should allow the userto select one package, one phone, and any of the options desired. As the user selects itemsfrom the menu, the application should show the prices of the items selected.arrow_forward
- 1. Create a class FruitBasket 2. Create a stack object named basket 3. Ask the user to input the number of fruits he/she would like to catch 4. Ask the user to choose a fruit to catch by pressing 'A' for apple, 'o' for orange, 'M' for mango, and 'G' for guava 5. Display all the fruits that the basket has 6. Ask the user to Enter 'E' to start eating a fruit 7. Display the fruits remaining each time 'E' is entered and "No More Fruits" when the basket becomes emptyarrow_forwardJAVA PROGRAM Lab #1 Enhancements:1. For the maximum and minimum rainfall amount, also display the month where that happened. For example:a. Maximum rainfall: January, 88.2 inchesb. Minimum rainfall: July, 12.3 inches2. Format all numbers with 1 decimal pointsMain class name: RainFall2 (no package name) HERE IS A WORKING CODE, PLEASE MODIFY THIS CODE SO WHEN I UPLOAD IT TO HYPERGRADE IT PASSES ALL THE TEST CASSES. IT HAS TO PASS ALL THE TEST CASSES. THANK YOU import java.util.*;public class Main{ public static void main(String[] args) { String maxRainfallMonth = "",minRainfallMonth = ""; double maxRainfall,minRainfall,rainFall,avg,tot=0; Scanner sc = new Scanner(System.in); System.out.println("Enter the rainfall for month 1: "); double rainfall = sc.nextDouble(); maxRainfall = rainfall; minRainfall = rainfall; tot = rainfall; String[] months = {"January","February","March","April",…arrow_forwardJAVA PROGRAM Lab #1 Enhancements:1. For the maximum and minimum rainfall amount, also display the month where that happened. For example:a. Maximum rainfall: January, 88.2 inchesb. Minimum rainfall: July, 12.3 inches2. Format all numbers with 1 decimal pointsMain class name: RainFall2 (no package name) HERE IS A WORKING CODE, PLEASE MODIFY THIS CODE SO WHEN I UPLOAD IT TO HYPERGRADE IT PASSES ALL THE TEST CASSES. IT HAS TO PASS ALL THE TEST CASSES BECAUSE RIGHT KNOW IT DOES NOT PASS THE TEST CASES. THANK YOU import java.util.*;public class Main{ public static void main(String[] args) { String maxRainfallMonth = "",minRainfallMonth = ""; double maxRainfall,minRainfall,rainFall,avg,tot=0; Scanner sc = new Scanner(System.in); System.out.println("Enter the rainfall for month 1: "); double rainfall = sc.nextDouble(); maxRainfall = rainfall; minRainfall = rainfall; tot = rainfall; String[] months =…arrow_forward
- In Javaarrow_forwardIn Java Programming Languagearrow_forwardJAVA PROGRAM Lab #1 Enhancements:1. For the maximum and minimum rainfall amount, also display the month where that happened. For example:a. Maximum rainfall: January, 88.2 inchesb. Minimum rainfall: July, 12.3 inches2. Format all numbers with 1 decimal pointsMain class name: RainFall2 (no package name) WHEN I UPLOAD THE CODE TO HYPERGRADE IT MUST PASS ALL THE TEST CASSES. IT HAS TO PASS ALL THE TEST CASSES. THANK YOU. Test Case 1 Enter the rainfall amount for month 1:\n1.2ENTEREnter the rainfall amount for month 2:\n2.3ENTEREnter the rainfall amount for month 3:\n3.4ENTEREnter the rainfall amount for month 4:\n5.1ENTEREnter the rainfall amount for month 5:\n1.7ENTEREnter the rainfall amount for month 6:\n6.5ENTEREnter the rainfall amount for month 7:\n2.5ENTEREnter the rainfall amount for month 8:\n3.3ENTEREnter the rainfall amount for month 9:\n1.1ENTEREnter the rainfall amount for month 10:\n5.5ENTEREnter the rainfall amount for month 11:\n6.6ENTEREnter the rainfall…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT