Java Programming
9th Edition
ISBN: 9780357616635
Author: Joyce Farrell
Publisher: CENGAGE L
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
In java
Create a class called StudentAge. This class should allow the student to enter name and date of birth. After that, determine student age. Lastly, display student name, date of birth and age.
Chapter 2 Solutions
Java Programming
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
- In main(), prompt the user for two items and create two objects of the ItemToPurchase class. Before prompting for the second item, call scnr.nextLine(); to allow the user to input a new string.Ex: Item 1 Enter the item name: Chocolate Chips Enter the item price: 3 Enter the item quantity: 1 Item 2 Enter the item name: Bottled Water Enter the item price: 1 Enter the item quantity: 10arrow_forwardWrite a class, XXXX_TestVehicle, which does the following:1. Creates one Car object from information entered by the user.2. Creates one Truck object from information entered by the user.3. Creates an Array of Vehicles that can hold 10 objects.4. It creates up to 10 Vehicles objects from information entered by the userarrow_forwardCreate 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_forward
- QUESTION 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_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_forwardPlease written by computer source JAVA. This is my third time reposting this question. I need DATETEST class written to fit my ALREADY WRITTEN date.java. thank you!Write DateTest class which includes the main method. The program should create three objects of the Date class and one of them should use the default constructor and the other two use three-parameter constructor. Print all three dates using toString method. Change the month, day, and year of one of the dates using set methods, and then use get methods to display the new value of month, day, and year. Print all three dates again using printDate method. (please include comments)Here is my "date.java" I just need you to help with the test class package class Date { // month, day, and year as private instance variables. private int month; private int day; private int year; //default constructor public Date() { // set the date to 1/1/2000 this.month = 1; this.day = 1; this.year = 2000; } // three-parameter constructor will…arrow_forward
- Write an application TestStudent that prompts for and reads a student name. It then creates a Student object. It then prompts for and reads the number of quizzes n that the student has taken. It then prompts for and reads the scores of the student in n quizzes and adds each to the totalScore of the student using addQuiz() method. Finally, the application prints the student object using the toString() method, and it also prints his quiz average. The main method must handle java.util.InputMismatchException, java.lang.IllegalArgumentException and java.lang.Unsupported OperationException.arrow_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_forwardThe 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_forward
- Java Questions - Based on the code, which answer out of the choices "1, 2, 3, 4, 5" is correct. Explanation is not needed, just please make sure that the answer you have chosen is the correct option. Thanks. Question is in attached picture.arrow_forwardCreate 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_forwardWrite an interactive version of the InchesToFeet class that accepts the inches value from a user.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
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