MindTapV2.0 for Farrell's Java Programming with 2021 Updates, 9th Edition [Instant Access], 1 term
9th Edition
ISBN: 9780357505540
Author: Farrell; Joyce
Publisher: Cengage Learning US
expand_more
expand_more
format_list_bulleted
Question
Chapter 2, Problem 9PE
Program Plan Intro
Inches to Feet
Program Plan:
Define the class “InchesToFeetInteractive”.
- Define the main method.
- Declare named constant variables to hold the number of inches in a foot.
- Create a scanner class object to get user input.
- Prompt the user to enter number of inches.
- Convert the user input and store it in a variable.
- Compute number of feet in the given inches by dividing given number of inches and number of inches in a foot.
- Compute number of inches left by taking modulus of given number of inches and number of inches in a foot.
- Display number of feet in the given number of inches.
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
Creating Enumerations In this section, you create two enumerations that hold colors and car model types. You will use them as field types in a Car class and write a demonstration program that shows how the enumerations are used.
1. Open a new file in your text editor, and type the following Color enumeration: enum Color {BLACK, BLUE, GREEN, RED, WHITE, YELLOW};
2. Save the file as Color.java.
3. Open a new file in your text editor, and create the following Model enumeration: enum Model {SEDAN, CONVERTIBLE, MINIVAN};
4. Save the file as Model.java. Next, open a new file in your text editor, and start to define a Car class that holds three fields: a year, a model, and a color. public class Car { private int year; private Model model; private Color color;
5. Add a constructor for the Car class that accepts parameters that hold the values for year, model, and color as follows: public Car(int yr, Model m, Color c) { year = yr; model = m; color = c; }
6. Add a display()…
using JAVA
Create a class called Transcript which will take the following parameters for its constructor:-
1. The UoF ID of the student
2. The full name of the student
3. The year in which the student joined
4. The student's GPA score
NOTE: The class also has a class field which is a 2D array with 32 elements containing the course codes and grades obtained by the student
Please provide JAVA source code for following assignment. Please attach proper comments and read the full requirements.
The local Driver’s License Office has asked you to write a program that grades the written portion of the driver’s license test The test has 20 multiple choice questions. Here are the correct answers:
B
D
A
A
C
A
B
A
C
D
B
C
D
A
D
C
C
D
D
A
A student must correctly answer 15 of the 20 questions to pass the exam.
Write a class named Drivertest that holds the correct answers to the test in an array field. The class should also have an array field that holds the student’s answers. The class should have the following methods:
passed. Returns true if the student passed the test, or false if the student failed
totalCorrect. Returns the total number of correctly answered questions
totalIncorrect. Returns the total number of incorrectly answered questions
questionsMissed. An int array containing the…
Chapter 2 Solutions
MindTapV2.0 for Farrell's Java Programming with 2021 Updates, 9th Edition [Instant Access], 1 term
Ch. 2 - Prob. 1RQCh. 2 - Prob. 2RQCh. 2 - Prob. 3RQCh. 2 - Prob. 4RQCh. 2 - Prob. 5RQCh. 2 - Prob. 6RQCh. 2 - Prob. 7RQCh. 2 - Prob. 8RQCh. 2 - Prob. 9RQCh. 2 - Prob. 10RQ
Ch. 2 - Prob. 11RQCh. 2 - Prob. 12RQCh. 2 - Prob. 13RQCh. 2 - Prob. 14RQCh. 2 - Prob. 15RQCh. 2 - Prob. 16RQCh. 2 - Prob. 17RQCh. 2 - Prob. 18RQCh. 2 - Prob. 19RQCh. 2 - Prob. 20RQCh. 2 - Prob. 1PECh. 2 - Prob. 2PECh. 2 - Prob. 4PECh. 2 - Prob. 5PECh. 2 - Prob. 6PECh. 2 - Prob. 7PECh. 2 - Prob. 8PECh. 2 - Prob. 9PECh. 2 - Prob. 10PECh. 2 - Prob. 11PECh. 2 - Prob. 12PECh. 2 - Prob. 13PECh. 2 - Prob. 14PECh. 2 - Prob. 15PECh. 2 - Prob. 16PECh. 2 - Prob. 1GZCh. 2 - Prob. 3GZCh. 2 - Prob. 1CPCh. 2 - Prob. 2CP
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
- Create a constructor for the Student class you created. The constructor should initialize each Student’s ID number to 9999, his or her points earned to 12, and credit hours to 3 (resulting in a grade point average of 4.0). Write a program that demonstrates that the constructor works by instantiating an object and displaying the initial values. Save the application as ShowStudent2.java.arrow_forwardA company accepts user orders by part numbers interactively. Users might make the following errors as they enter data: - The part number is not numeric. The quantity is not numeric. - The part number is too low (less than 0). - The part number is too high (more than 999). - The quantity ordered is too low (less than 1). - The quantity ordered is too high (more than 5,000). Create a class that stores an array of usable error messages; save the file as DataMessages.java. Create a DataException class; each object of this class will store one of the messages. Save the file as DataException.java. Create an application that prompts the user for a part number and quantity. Allow for the possibility of nonnumeric entries as well as out-of-range entries, and display the appropriate message when an error occurs. If no error occurs, display the message "Valid entry". Save the program as PartAndQuantityEntry.java.arrow_forwardQUESTION 1 Write a Java program that creates and displays the following GUI. (In this problem there is no need to program any listener response to user actions.) Name your class Exam2Window. Translation Languages English to Spanish Spanish to English English to Chinese Chinese to English Click Save and Submit to save and subemit. Click Save All Answers to save all answers. Save All Ansarrow_forward
- The Huntington Boys and Girls Club is conducting a fundraiser by selling chili dinners to go. The price is $7 for an adult meal and $4 for a child’s meal. Write a class that accepts the number of each type of meal ordered and display the total money collected for adult meals, children’s meals, and all meals. Save the class as ChiliToGo.java.arrow_forwardStarting Out with Java From Control Structures through Objects 6th Editionarrow_forwardFor your homework assignment, build a simple application for use by a local retail store. Your program should have the following classes: Item: Represents an item a customer might buy at the store. It should have two attributes: a String for the item description and a float for the price. This class should also override the __str__ method in a nicely formatted way. Customer: Represents a customer at the store. It should have three attributes: a String for the customer's name, a Boolean for the customer's preferred status, and a list of 5 indexes to hold Item objects. Include the following methods: make_purchase: accepts a String and a double as parameters to represent the name and price of an item this customer is purchasing. Create a new Item object with this info and append it to the internal list. If the customer is a preferred customer based on the Boolean attribute's value, take 10% off the total sale price. __str__: Override this method to print the customer's name and every…arrow_forward
- Create a constructor for the Student class you created. The constructor should initialize each Student's ID number to 9999, his or her points eamed to 15, and credit hours to 3 (resulting in a grade point average of 3.0). Write a program that demonstrates that the constructor works by instantiating an object and displaying the initial values. ShowStudent2.java. Save the application asarrow_forwardQ1. Print the name of the class that may handle ALL the mouse events: . Q2. To re-draw a JFrame's ContentPane, the programmer should write Q3. To enable the LEFT section of a horizontal JSplitPane to be resizable, the programmer should write:. 04. What is the data type of the "X" in the following code: "if (X.isPopupTrigger()"? Q5. What is the "X" in the following code: "new Timer(80, X)."? 06. Create a method to display your class-schedule on a JTable (as shown below)? Add a new course to the table? Course Number 901310 901332 901330 D01340 Course Title Visual Programming Operating Systems Database M Systems Algonthimsarrow_forwardWrite a class that calculates and displays the conversion of an entered numberof Rands into currency denominations—100s, 20s, 10s and 1s. Create a currency object to be able to use the ZAR symbol and display it before showing all results.Save the class as Rands.java.arrow_forward
- urgennt plsarrow_forwardIntro to Programming: Exercise 3: Basketball.py Write a class called Basketball that inherits from the UniversityAthletics class you wrote in previous exercises. Add an attribute called gender that stores mens and womens. Write a method that displays the genders. Create an instance of Basketball, and call this method.arrow_forwardCreate class for Electricity for N flats of an apartment. The required details are Flat number, EB meter number, Owner name, Previous month reading( in units), current month reading ( in Units), amount. Except amount and EB meter number remaining values will be accepted from the user. EB meter number could be random number generated between 10000 to 20000. Amount will be calculates as below: 0-100 Minimum charges =100 100-500 2.5 ₹ per unit 500-1000 5.0 ₹ per unit Above 1000 7.5 ₹ per unit Write appropriate functions to perform the following: · Display the flat and owner details who paid maximum and minimum EB charges. · Display the average amount paid by all flats in each floor. Floor will be identified from the first digit of a flat number. For 1001 – first floor , 2005 – second floor, 5010- Fifth floor. Display the floor wise details. · Display the Flat number, EB amount along with the meter number in the ascending order of the meter number. note: java…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Memory Management Tutorial in Java | Java Stack vs Heap | Java Training | Edureka; Author: edureka!;https://www.youtube.com/watch?v=fM8yj93X80s;License: Standard YouTube License, CC-BY