Write a java program that asks user to input these values: 1. The number of gallons of gas in the tank 2. The fuel efficiency of car in Kilometers per gallon 3. The price of gas per gallon Then compute and display: • The cost per 100 miles. • How far the car can go with the gas in the tank. (kilometers)
Q: Code the following statments in JAVA If your average time to run each mile is under 11 minutes,…
A: Step-1: StartStep-2: Declare variable avgTime and take input from userStep-3: if avgTime is greater…
Q: Write a Java program that asks the user to enter 2 integer numbers. Your program using the…
A: Operators In Java: Any programming language's building blocks are its operators, and Java is no…
Q: In JAVA language, write a program to input the distance in kilometers and convert the distance into…
A: In JAVA language, write a program to input the distance in kilometers and convert the distance into…
Q: Write a Java program to sell a limited number of cinema tickets. Each person can buy up to 4…
A: First total 100 tickets are available. Each person can buy maximum 4 tickets if he want to buy more…
Q: To make a profit, a local store marks up the prices of its items by a certain percentage. Write a…
A: Note: Below is the required program in java language. Programming Approach: Importing appropriate…
Q: Write a java program that displays a square shape of the first letter of your name. Your program…
A: Please find the answer below :
Q: Write a program that prompts a student to enter a Java score. If the score is greater or equal to…
A: Here to end the program, we need to input -1. Thus we need to use loop. Also since language not…
Q: If you want to build a system for calculating gasoline consumption in cars, use the Java language to…
A: GasMileage.java public class GasMileage{ double totalMiles, totalGallons; public double…
Q: Create a Java program that will read a date (month, day and year) in integer form and display the…
A: Simple Date Format is a concrete class for formatting and parsing dates in a locale-sensitive…
Q: Write a Java program that asks the user to enter 2 integer numbers. Your program using the…
A: Let's execute this in Java .
Q: Write a Java program prompts the user to enter in three integers. The program should then calculate…
A: java code: import java.util.*; publicclass Main { publicstaticvoid main(String[] args) { Scanner in…
Q: Write a program that allows the user to enter a number of integers until the user inputs zero. (0)…
A: import java.util.Scanner; public class NumberStats { public static void main(String[] args) {…
Q: X=3; if (x==3) if (2!=2) y=++x; else y=x++; y++;
A: We have to fine the values of x and y after the statement are executed.
Q: Write a program which takes user input as a number abd find out the square and cube of the number.
A: import java.util.Scanner; public class CubeSquareRoots { public static void main(String[ ] args) {…
Q: Write a program that asks user to enter a number. Then the program should print the sum of all…
A: Please find the answer below :
Q: Write a java program that ask the user to enter number of days in the month, then reads the daily…
A: logic:- read value of n iterate from I=0 to I<n Read values in array arr. end loop set…
Q: JAVA PROGRAM A bank offers a 3% interest per annum for savings accounts. The bank also has 1%…
A: A bank account is a ledger that is gainful for salaried people or those with a customary month to…
Q: Write a Java program that prompts the user to enter a line of text and outputs the number of digits,…
A: //import the required package import java.util.Scanner; //create a main class public class Counting…
Q: Write a java program to take the number from the user and prints you look older than
A: import java.util.Scanner; publicclassNumOld { public static void main(String[] args) //…
Q: Write a complete Java program that prompts the student to enter the credit hours earned and then…
A: PROGRAM CODE: import java.util.*; // import java utility packagepublic class…
Q: Write a java program that outputs and prints the number of hours, minutes, and seconds that…
A: public class Main { private static int SECONDS_PER_HOUR = 3600; private…
Q: Write a Java program that reads two integer numbers. The program must output the greater of the two…
A: import java.util.Scanner;//to read input from userpublic class Main{ public static void…
Q: Question 2 Write a Java program that will ask the user for the number of rooms (including kitchens…
A: Code copy: import java.io.*; import java.util.Scanner; class Rooms { public static void main(String…
Q: In Java Find the value of x , y after the statements are executed: y=1; x=0; if (x>0) { if (2==2)…
A: if else is a conditional statement. If condition gets true then statement within if is executed…
Q: Using Java, make a program that computes and displays various properties of a circle. For the…
A: The required java program using input/output processing has been given in the next step.
Q: 2. Write a Java program to calculate and print the monthly paycheck for an employee. The net pay is…
A: Program description: The java program, PayCheck.java that prompts the user to enter the employee id…
Q: Write a java program that displays a triangle shape of the first letter of your name. Your program…
A: Main logic:- Input value of n from user. check n must be greater than 0 using if else. set…
Q: For an invoice calculation program, write the JAVa program that calculates the amount of VAT and the…
A: It is defined as a powerful general-purpose programming language. It is used to develop desktop and…
Q: program in java that allows the user to enter his name and his monthly salary.then calculate the…
A: Code import java.util.*; public class ScannerNextFloatExample1 { public static void…
Q: This is a java question just give me the explanation and the output pleas
A: First is a class which has an instance variable i Its constructor accepts a parameter and prints the…
Q: Create a Java Program that converts measurements in feet and inches into centimeters using Scanner.…
A: Logic:- read feet and inches from user. Multiply feet by 12 and add inches to get total inches…
Q: Write a JAVA program to read input the age (in years) and weight (in kg) from the user and check if…
A: Write a JAVA program to read input the age (in years) and weight (in kg) from the user and check if…
Q: Write a program that simulates a traffic light. The program lets the user select one of three…
A: Answer : Program code : //TrafficLightSimulate.java//import the required packagesimport…
Q: Write a java code that prints a 4 digit number supplied by the user, vertically using modulus and…
A: Take the user input for 4 digit number ex. 1234 Then take modulo 10 of the number 1234 % 10 will…
Q: Write a Java program that prompts the user to enter their weight in Kilograms and then convert it in…
A: Input weight in kg. multiply input by 2.2046 and store in variable display output . end.
Q: Java code for this: Given two number for the variables A and B, create a program that would: A.…
A: Write a program using java that will follow the following conditions and given output: Given two…
Q: Assume that a runner runs 15 kilometers in 50 minutes and 30 seconds. Write a Java program that…
A: The, answer has given below:
Q: Write a Java program for a Play-House Manager, who would like to calculate the total profit from…
A: The JAVA code is given below with code and output screenshot
Q: 5. Write a Java program that reads a number in inches then converts it to meters. Note that One inch…
A: Program outline: Ask user to input a number in inches. Use Scanner class of java to take user…
Q: Write a Java program that prompts the user to enter their weight in Kilograms and then convert it in…
A: Algorithm: 1. Read weight in Kilograms as weightKg. 2. Convert into Pounds as weightPounds =…
Q: Output a half pyramid of stars with a height determined by the user. If the user enters a number…
A: Given: Output a half pyramid of stars with a height determined by the user. If the user enters a…
Q: Write a program that computes the average of 5 students grades which are entered by the user.
A: Here we can accept the 5 student grades in an array of integer called grades[5].
Q: Write a Java program that computes the prizes distributed on the top 4 winners of a competition. 1)…
A: Required:
Q: Write a Java program that lets the user enter the monthly interest rate, number of years, and loan…
A: In this question we are asked to display monthly payment and total payment as per the formula given.…
Q: An Arabian legend has it that a fabulously wealthy but unthinking king agreed to give a bigger one…
A: Algorithm 0.Start 1.Declare variable amt = 0.01 as initial amount 2.Declare varaible day = 1 as…
Q: In Java Find the value of x , y after the statements are executed: y=2; if (y>2) y=4; else y=7;…
A: if else is a conditional statement in which condition within if is checked. If it is true then…
Q: (2) Write a Java program that prompts the user to enter two integer numbers a and b, then it…
A: import java.util.*; public class Power { public static void main(String[] args) { int…
Q: Write a java program that calculates a customers' electric bill. The program should ask the user to…
A: Program Approach:- 1. Import util package 2. Create the user-defined class whose name is Main 3.…
Q: Write a java program. Drinks such as Coffee, Tea, Cola and energy drinks contain caffeine level.…
A: Algorithm: Start Read no.of green tea cups consumed Calculate result=28*no.of green tea cups…
Q: write a java programme for this question Suppose you want to deposit a certain amount of money into…
A: import java.util.*; public class HelloWorld{ public static double presentValue(double f, double r,…
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images
- An Arabian legend has it that a fabulously wealthy but unthinking king agreed to give a bigger one cent and double the amount for 60 days. Using this information write, run and test a Java program that displays how much King must pay the beggar each day. example days. Amount 1. 0.01 2. 0.02 3. 0.04 . 64 days. .... note:- 1) modify the program that you have write To determine on which day king must have paid the beggar a million dollarA supermarket awards coupons depending on how much a customer spends on groceries. For example, if you spend $50, you will get a coupon worth eight percent of the amount. The following table shows the percent used to calculate the coupon awarded for different amounts spent. Write a JAVA program that calculates and prints the value of the coupons a person can receive based on groceries purchased. Money Spent Coupon Percentage Less than 10$ No coupon $10-$59 8% $60-$149 10% $150-$209 12% $210 or more 14% Here is a sample run: Please enter the cost of your groceries: 14 You win a discount coupon of $1.12. (8% of your purchase)To make a profit, a local store marks up the prices of its items by a certain percentage. Write a Java program that reads the original price of the item sold, the percentage of the marked-up price, and the sales tax rate. The program then outputs the original price of the item, the marked-up percentage of the item, the store’s selling price of the item, the sales tax rate, the sales tax, and the final price of the item java programming
- java Suppose a launched toy rocket's height is computed as h = vi*t - 5t2. vi is the initial velocity, and t is time in seconds since the launch (starting at 0). Write a java program to read the initial velocity, then output the time and the rocket's height once per second. Stop when the height would be negative, meaning the rocket hit the ground (don't print the negative). Assume all values are integers. Ex: For input 20, the output is: 0 0 1 15 2 20 3 15 4 0 Hints: Use a while loop. t squared is easily calculated as t * t. Use this expression for the while loop: (rocketHeight >= 0). Don't forget to increment time inside the while loop (otherwise you'll get an infinite loop). import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int rocketHeight = 0; int initialVelocity = 0; int timeSinceLaunch = 0; /* Type your code here. */ }}A company has 5 stores {1, 2, 3, 4, 5}. The sales for each store is as follows: {200, 300, 400, 500, 600}. The tax rate is 6% Write a java program that: 1) Calculates the sales tax for each store and the total sales tax for the company.Use java programming. Write a program that helps a person decide whether to buy a hybrid car. Your program’s inputs should be: •The cost of a new car •The estimated miles driven per year •The estimated gas price •The efficiency in miles per gallon •The estimated resale value after 5 years Compute the total cost of owning the car for five years. (For simplicity, we will not take the cost of financing into account.) Obtain realistic prices for a new and used hybrid and a comparable car from the Web. Run your program twice, using today’s gas price and 15,000 miles per year. Include pseudocode and the program runs with your assignment.
- 1. Write a complete JAVA program that display 5 types of fruit with their price. The fruits and their prices is (Apple =1$/ pieces), (Mango= 2$/kg), (Rambutan=2$/kg), (Mangosteen=4$/kg) and (Раpaya=5$/kg) . Then ask the user to input the respective quantity and calculate the total price user needs to pay. Apply loop in your program.Assume that a runner runs 15 kilometers in 50 minutes and 30 seconds. Write a Java program that displays the average speed in miles per hour. (Note that 1 mile is 1.6 kilometers.). Note: You have to replace the question mark with the correct answer.The following pseudocode describes how a bookstore computes the price of an order from the total price and the number of books that were ordered Read the total book price and the number of books. Compute the tax (8.5 percent of the total book price). Compute the shipping charge ($3.5 per book). The price of the order is the sum of the total book price, the tax, and the shipping charge. Print the price of the order. Translate this pseudocode into a Java Program.
- The two forces acting on an aircraft in flight are lift (acting upwards) and weight (acting downwards). If the lift of the aircraft equals the weight of the aircraft, then the aircraft neither goes up nor down, it is in level flight. If the lift is greater than the weight, then the aircraft climbs (gains altitude). If the weight is greater than the lift, then the aircraft descends (loses altitude) Write a Java program named Flying that calculates whether an aircraft is flying level, climbing or descending. The basic equation to calculate this lift is known as the Flight Equation. The Flight Equation is: L = 1 / 2 * ρ * v2 * s *cl where L = lift (in Newtons), this must equal the weight of the aircraft for the aircraft to fly. To convert kilograms to Newtons multiply kilograms by 9.8 ρ = density of the air, in kg / m3 This value is a maximum of 1.2 at sea level and decreases as altitude (height) increases v = current speed, in metres / second of the aircraft. s = surface area…The two forces acting on an aircraft in flight are lift (acting upwards) and weight (acting downwards). If the lift of the aircraft equals the weight of the aircraft, then the aircraft neither goes up nor down, it is in level flight. If the lift is greater than the weight, then the aircraft climbs (gains altitude). If the weight is greater than the lift, then the aircraft descends (loses altitude) Write a Java program named Flying that calculates whether an aircraft is flying level, climbing or descending. The basic equation to calculate this lift is known as the Flight Equation. The Flight Equation is: L = 1 / 2 * ρ * v2 * s *cl where L = lift (in Newtons), this must equal the weight of the aircraft for the aircraft to fly. To convert kilograms to Newtons multiply kilograms by 9.8 ρ = density of the air, in kg / m3 This value is a maximum of 1.2 at sea level and decreases as altitude (height) increases v = current speed, in metres / second of the aircraft. s = surface area…The two forces acting on an aircraft in flight are lift (acting upwards) and weight (acting downwards). If the lift of the aircraft equals the weight of the aircraft, then the aircraft neither goes up nor down, it is in level flight. If the lift is greater than the weight, then the aircraft climbs (gains altitude). If the weight is greater than the lift, then the aircraft descends (loses altitude) Write a Java program named Flying that calculates whether an aircraft is flying level, climbing or descending. The basic equation to calculate this lift is known as the Flight Equation. The Flight Equation is: L = 1 / 2 * ρ * v2 * s *cl where L = lift (in Newtons), this must equal the weight of the aircraft for the aircraft to fly. To convert kilograms to Newtons multiply kilograms by 9.8 ρ = density of the air, in kg / m3 This value is a maximum of 1.2 at sea level and decreases as altitude (height) increases v = current speed, in metres / second of the aircraft. s = surface area…