Item Name: TV Stand Retail Price: $325 Wholesale Price: $200 Profit: $125 Sale Price: $243.75 Sale Profit: $43.75
Q: i got this error when I try to compile my code. What should I do? Should i change the name of my…
A: the answer is given below:-
Q: Write a complete Java program to handle weather forecasts. The program should prompt the user for…
A: The answer is given below:-
Q: Create a java program that reads integers from the user until the enter key is pressed. Oncea allof…
A: The program is written in java import java.util.Scanner; public class Main{ public static void…
Q: I have no idea how to start this problem. This is the question - Write a program that declares two…
A: PROGRAM: //Importing time header file to access the functions import java.time.*; //Defining the…
Q: Develop a program that calculates the total score and the average score for Quiz and classwork…
A:
Q: 3. Write a Java application class that does the following: Input a text file name entered by the…
A: public class HotelRoom { // attributes private int roomNo; private String phoneNumber;…
Q: Assume you have a text file named in.txt with the following contents: All what-ifs And what can’t…
A: We can write to a file using FileWriter class. The below is the complete code:-
Q: Create a java program that calculates the average test scores. Given the student’s name and five…
A: I have given an answer in step 2.
Q: PROBLEM: You are to write a program in Java that takes in as input a string message and an integer.…
A: File name: “TestClass.java” import java.util.Scanner; public class TestClass { public static void…
Q: This is in Java please: A comma separated value (.csv) file has been included to be used for this…
A: Actually, java is a object oriented programming language.
Q: Create an application in Java that converts number grades to letter grades. Console
A: Java code: import java.util.Scanner; //class declarationpublic class Main { //main method public…
Q: Using switch statements, build a Java class file to calculate the area of a figure (call it…
A: logic:- read user’s choice. Pass user’s choice within switch define three cases circle, square…
Q: What is the output of the following java code? = new File ("C:\\Users\\t99\\Desktop\\java.txt");…
A:
Q: I am trying to figure out why the sum at the end of my Java code is not working correctly. It keeps…
A: import java.io.FileWriter; import java.io.File;import java.util.Scanner; public class Main{…
Q: A file named ClassData.txt contains records of several students. Each record contains student's name…
A: The following information is given: A file "ClassData.txt" with detail is given of each student…
Q: How to read to and from a text file in JAVA so the user can close the program and pick up where they…
A: Java is a general purpose object oriented programming language which is also known as OOPs language.…
Q: This is to be programed in java You will create a driver file called personalInfo.java…
A: Here I have created the class Person with attributes and constructor. Then, I have created a method…
Q: Create a Java program that uses a loop for • Reads from the console the names, weight in kg and…
A: public class Main { //Main Function public static void main(String[] args) { //Creating the…
Q: The Body Mass Index is the body mass in kilogram divided by the square of body height in meters.…
A: import java.io.BufferedReader;import java.io.File;import java.io.FileReader;import…
Q: In java, create a program that gathers user input and prints a paystub. This assignment requires one…
A: Start. Get the details. Perform the operation to find the paystub. Print the result. Exit.
Q: Can you please Write a return method called highest CommonFactor() that returns the highest common…
A:
Q: Write a program in Java Modify the program you wrote for Programming Challenge 2 (Distance…
A: To write the required program first of all we have to complete challenge 2.
Q: Write a simple game in Java named GuessNumber.java to run on the command line. This program asks…
A: Program code: //Importing essential header files import java.util.Random; import java.util.Scanner;…
Q: Write/Create a Java objects and class program that creates a car object, and displays the year and…
A: Write/Create a Java objects and class program that creates a car object, and displays the year and…
Q: e make, YYYY is the year it was manufactured, C is the first letter of the colour and XX is the…
A: Create a simple java program that reads all the content in a .txt file, the user will enter the…
Q: A file named ClassData.txt contains records of several students. Each record contains student's name…
A: import java.util.Scanner;import java.io.*; public class Main { static double…
Q: a simple java program that reads all the content in a .txt file, the user will enter the filename to…
A: It is defined as a high level, robust, object-oriented and secure programming language. It is known…
Q: Test Case 1 Enter length: \n 5 ENTER Enter width: \n 10 ENTER You entered: 5.0, 10.0, and 50.0 \n…
A: Here I have created all the functions that were given in the question. In the method getLength() and…
Q: Write a java program that read unknown number of records from the file attached below named…
A: The java program is given by import java.util.*; import java.io.*; class Main { finalstatic String…
Q: [JAVA Code] In this lab, you will open the file, flowers.dat, and read input from that file in a…
A: Given below is the implementation of the program in java language. Further comments are added in the…
Q: In Chapter 4, you created a class named Game that included two Team objects that held data about…
A: public class Team{ //declaring instance variables private String name; private String sport;…
Q: Let's create our first Java file, called Welcome.java, which can be done in any text editor (like…
A: Given: Output of Java Program.
Q: 3. Write Java code to do what the comment says (without changing any of the given code): Scanner…
A: Given: Scanner stdinScanner = new Scanner (System.in);System.out.print ("Please enter the year you…
Q: In Java Only: My program is not working correctly, The history teacher at your school needs help…
A: Note: As you have asked to remove the "NullPointerException" from the calculatePoint function of the…
Q: Create a file named Validate.java , in that file create a method with the following signature:…
A: Java Code for above : import java.util.Scanner; public class Validate { //required function…
Q: Write an application that prompts a user for the number of years the user has until retirement and…
A: Syntax: do { // Loop-body } while ( Condition ) ; Flowchart:
Q: This question is in Java. You will create a driver file called personalInfo.java. you will also…
A: //personalInfo.java import java.util.*; public class personalInfo { public static void…
Q: Data is stored in the following format: Here is a sample datafile. File: cars.txt…
A: According to the information given :- we have to create a java script file that read cars.txt file…
Q: he program will read and store the bad words(Kill,killer,assault,etc.) from the file. Then, it will…
A: code : ProfanityChecker.java import java.io.BufferedReader;import java.io.File;import…
Q: 39. You are designing an application for a school and are given the following specific • For a given…
A: Below I have provided a solution for the given program
Q: I am trying to figure out why the sum at the end of my Java code is not working correctly. It keeps…
A: the answer is given below:-
Q: IN JAVA Which XXX is needed for enterNumber() to read a value from standard input? public…
A: Which XXX is needed for enterNumber() to read a value from standard input? public int enterNumber()…
Q: Write a java program that generates five questions where two numbers were subtracted and, after a…
A: import java.util.Scanner;import java.util.Random;public class SubtractionLoop{ public static void…
Q: a. Four integer variables have been declared and initialized: p1 = 1, p2 = 2, p3 = 3, and p4 = 4.…
A: Write a JAVA program to declare and initialize four integer variables p1 = 1, p2 = 2, p3 = 3, and p4…
Q: Create a simple java program that reads all the content in a .txt file, the user will enter the…
A: Program Explanation: 1) Implement the header file. 2) Declare the integer and assign the values. 3)…
Q: Create an associative container to store movie names and ratings. Add a few films to the container.…
A: Associative Containers can be implemented using Map
Q: Write an application that asks a user to enter an integer. Display a statement that indicates…
A: There are two solution of your problem, either you have use return type void in place of boolean…
In this lab, you complete a partially written Java
Instructions
- Ensure the file named Furniture.java is open.
- The file includes variable declarations and output statements. Read them carefully before you proceed to the next step.
- Design the logic and write the Java code that will use assignment statements to:
- Calculate the profit (profit) as the retail price minus the wholesale price
- Calculate the sale price (salePrice) as 25 percent deducted from the retail price
- Calculate the sale profit (saleProfit) as the sale price minus the wholesale price.
-
Execute the program by clicking Run. Your output should be as follows:
Item Name: TV Stand Retail Price: $325 Wholesale Price: $200 Profit: $125 Sale Price: $243.75 Sale Profit: $43.75
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images
- Write a program in Java Modify the program you wrote for Programming Challenge 2 (Distance Traveled) so itwrites the report to a file instead of the screen. Open the file in Notepad or another texteditor to confirm the output. Challenge 2 : The distance a vehicle travels can be calculated as follows:Distance = Speed * TimeFor example, if a train travels 40 miles-per-hour for three hours, the distance traveled is120 miles. Write a program that asks for the speed of a vehicle (in miles-per-hour) and thenumber of hours it has traveled. It should use a loop to display the distance a vehicle hastraveled for each hour of a time period specified by the user. For example, if a vehicle istraveling at 40 mph for a three-hour time period, it should display a report similar to theone that follows: "Photo in the attachments" Input Validation: Do not accept a negative number for speed and do not accept any valueless than 1 for time traveledCreate a java program that calculates the average test scores. Three employees in a company are ups for a special pay increase. You are given a file; ABCompany.txt, with the following data: Miller Andrew 65789.87 5 Green Sheila 75892.56 6 Sethi Amit 74900.50 6.1 Each input line consists of an employee’s last name, first name. Current salary and percent pay increase. For example, in the first input line, the last name of the employee is Miller, the first name is Andrew, the current salary is 65789.87 and the pay increase is 5%. Write a program that reads the data from the specified file and stores the output in the file ABCoutput.dat. For each employee, the data must be output in the following form: firstname lastname updated salary. Format the output of decimal numbers to two decimal places. Send a copy of the following: the java code Screenshot of the results screenshot of input file screenshot of output fileCreate a java program that calculates the average test scores. Three employees in a company are ups for a special pay increase. You are given a file; ABCompany.txt, with the following data: Miller Andrew 65789.87 5 Green Sheila 75892.56 6 Sethi Amit 74900.50 6.1 Each input line consists of an employee’s last name, first name. Current salary and percent pay increase. For example, in the first input line, the last name of the employee is Miller, the first name is Andrew, the current salary is 65789.87 and the pay increase is 5%. Write a program that reads the data from the specified file and stores the output in the file ABCoutput.dat. For each employee, the data must be output in the following form: firstname lastname updated salary. Format the output of decimal numbers to two decimal places. Send a copy of the following: the java code code Screenshot of the code screenshot of input file screenshot of output file
- In a Java program, create an automobile class that will be used by a dealership as a vehicle inventory program. The following attributes should be present in your automobile class: private string make, private string model, private string color, private int year, private int mileage. Your program should have appropriate methods such as: constructor, add a new vehicle, remove a vehicle, update vehicle attributes. At the end of your program, it should allow the user to output all vehicle inventory to a text file.I need help with creating a Java program described below: A Game of Twenty-One: Write a program that lets the user play against the computer in a variation of the popular blackjack card game. In this variation of the game, two six-sided dice are used instead of cards. The dice are rolled, and the player tries to beat the computer’s hidden total without going over 21. Here are some suggestions for the game’s design: Each round of the game is performed as an iteration of a loop that repeats as long as the player agrees to roll the dice, and the player’s total does not exceed 21. At the beginning of each round, the program will ask the user whether or not he or she wants to roll the dice to accumulate points. During each round, the program simulates the rolling of two six-sided dice. It rolls the dice first for the computer, and then it asks the user whether he or she wants to roll. Create a Die class to use with this application. The loop keeps a running total of both the computer…In Java. Prompt the user for two years. Print all the movies that were released in those years and that have a name that's fewer than 6 characters. File: db.txt Test Case 1 Movie search by year range. Enter two years.\n1970ENTER1974ENTERMovies with short names that were released between 1970 and 1974\nI dag\nIzumi\nJamie\nJamie\nJulie\nJulie\nKako\nKako\nKate\nKojak\nKojak\nKojak\nKojak\nKojak\nLeeds\nMaude\nMeshi\nMily\nNakia\nNakia\nNakia\nNakia\nNancy\nNanou\nTang\nThem\nTimo\nToma\nToma\nToma\nToma\nTotte\nTrial\nUFO\nUFO\nYak\nYak\nZoom\nZut!\nNumber of matches: 39\n Test Case 2 Movie search by year range. Enter two years.\n2050ENTER3000ENTERMovies with short names that were released between 2050 and 3000\nNo matching movies found!\n
- in java: Write a program that reads the following information and prints a payroll statement: Employee’s name (e.g., Smith) Number of hours worked in a week (e.g., 10) Hourly pay rate (e.g., 9.75) Federal tax withholding rate (e.g., 20%) State tax withholding rate (e.g., 9%) Your program must use proper formatting for the output either by using the printf command or String.formatWrite a Java program correctly that generates a report of proof of vaccination against COVID-19 for the peoplewho received their dose of vaccination. Write a program which:1. Display a welcome message.2. Then prompts the user to enter the following:• First name, with first letter uppercase, which is then stores in a variable of type String.• Last name, with first letter uppercase which is then stores in a variable of type String.• Day of birth, set as a number between 1 and 31, which is then stores in a variable of typeint.• Month of birth, set as a number between 1 and 12, which is then stores in a variable of typeint.• Year of birth, set as a number between 1920 and 2006, which is then stores in a variable oftype int.• Day of vaccination, set as a number between 1 and 31, which is then stores in a variable oftype int.• Month of vaccination. set as a number between 1 and 12, which is then stores in a variableof type int.• Year of vaccination, set as a number between 2020 and 2021,…java You must print the number declared double x; on the screen. With which of the following options do you know that a number in the range -9999.99999 to 9999.99999 is printed with exactly 4 decimals and that all numbers in the number are displayed? Choose an alternative: a.System.out.format ("%. 4f", x); b.System.out.format ("% 4.1f", x); c.System.out.format ("% b", x); d.System.out.format ("% s", x); e.System.out.format ("% d", x);
- Question 1: With Java, Write a program that will ask the user to enter the following personal information about himself/herself (full name, address, date of birth, phone), store each in a variable, the program will then print them, each on a separate line using one print statement. Question 2: The following are the ingredients of a donuts recipe (5 cup of sugar, 2 cup of butter, 6 cups of flour), this recipe makes 30 donuts . Write a program with Java that will ask the user how many donuts they want, the program will then print on screen how many cups of each ingredient is needed.Implement the below pseudo-code in a Java program using a while loop and aswitch-case statement. The program should be well structured, and the taskperformed under each option (at least options 'b' to 'e') should be implementedas a separate method.NOTE: The Scanner class does not have a method to input a character. Inorder to read a character from the keyboard, use one of the following methods(after declaring the Scanner object):static Scanner kb = new Scanner(System.in);1. char ch = kb.nextLine().charAt(0); OR2. char ch = kb.nextLine().toLowerCase().charAt(0);where kb is a Scanner class object.The second method above also converts the input to lowercase, which is oftenuseful. Though these methods allow the user to input more than one characteron the input line, the rest of the line (after capturing the first character withcharAt(0)) is discarded.If you also want to ignore the leading spaces before the first character thenuse:1. char ch = kb.nextLine().trim().charAt(0); OR2. char ch =…Write a simple game in Java named GuessNumber.java to run on the command line. This program asks the user to pick a number and the computer guesses the number repetitively until the guess is correct. Your program must mimic the program I attached here. Allow the user to set the lower and upper bound as command line parameters from where they pick the number. If no command-line parameters are specified then the program uses a default of 1 to 99.