subject

Write a program that declares constants to represent the number of inches, feet, and yards in a mile. Name the constants INCHES_IN_MILE, FEET_IN_MILE, and YARDS_IN_MILE respectively. Also declare a variable named miles to represent a number of miles. Compute and display, with explanatory text, the value in inches, feet, and yards—for example: 4.0 miles is 253440.0 inches, or 21120.0 feet, or 7040.0 yards.

This is what I have but it is only 50% correct:

import java. util. Scanner;
class MileConversions
{
public static void main(String[] args)
{
final double INCHES_IN_MILE = 63360.0;
final double FEET_IN_MILE = 5280.0;
final double YARDS_IN_MILE = 1760.0;
double miles = 4.0;

Scanner scanner = new Scanner(System. in);
System. out. print("Enter miles: ");
miles = scanner. nextDouble();

System. out. printf("%.1f miles is %.1f inches, or %.1f feet, or %.1f yards", miles, miles*INCHES_IN_MILE, miles*FEET_IN_MILE, miles*YARDS_IN_MILE);

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 13:00
Which part of the cpu accepts data?
Answers: 1
question
Computers and Technology, 23.06.2019 15:00
1. which of the following statements are true about routers and routing on the internet. choose two answers. a. protocols ensure that a single path between two computers is established before sending packets over it. b. routers are hierarchical and the "root" router is responsible for communicating to sub-routers the best paths for them to route internet traffic. c. a packet traveling between two computers on the internet may be rerouted many times along the way or even lost or "dropped". d. routers act independently and route packets as they see fit.
Answers: 2
question
Computers and Technology, 23.06.2019 16:30
20 points archie wants to use a reflector as he photographs a newlywed couple. what would he consider in his choice? a. shadow and sunny b. homemade and professional c. lamps and boards d. incident and reflected e. neutral density and enhancement
Answers: 3
question
Computers and Technology, 23.06.2019 18:30
List 3 items that were on kens resume that should have been excluded
Answers: 1
You know the right answer?
Write a program that declares constants to represent the number of inches, feet, and yards in a mile...
Questions
question
History, 20.09.2020 02:01
question
English, 20.09.2020 02:01
question
Mathematics, 20.09.2020 02:01
Questions on the website: 13722363