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 06:00
In outlook how can cherie look at the details of an event that appears on the month view of her calendar? check all that apply. by switching to the detail view by switching to the week view by switching to the day view by right-clicking on the event by double-clicking on the event by highlighting the event
Answers: 2
question
Computers and Technology, 22.06.2019 20:00
Amanda needs to create an informative print brochure for her local library’s fundraiser dinner. what critical detail must she have before she starts designing the brochure?
Answers: 1
question
Computers and Technology, 23.06.2019 09:00
Which company provides a crowdsourcing platform for corporate research and development? a: mtruk b: wiki answers c: mediawiki d: innocentive
Answers: 2
question
Computers and Technology, 23.06.2019 16:30
How to do this programming flowchart?
Answers: 3
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
Advanced Placement (AP), 14.07.2019 20:20
Questions on the website: 13722367