Welcome to AssignmentCache!

DAT/210 Week 2 Java LAB 3.18: Driving costs

Availability: In stock

$7.00

Quick Overview

DAT/210 Week 2 Java LAB 3.18: Driving costs


Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as input, and output the gas cost for 20 miles, 75 miles, and 500 miles.
Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
System.out.printf("%.2f", yourValue);
The output ends with a newline.


Ex: If the input is:
20.0 3.1599
the output is:
3.16 11.85 79.00


Note: Real per-mile cost would also include maintenance and depreciation.


import java.util.Scanner;


public class LabProgram {
public static void main(String() args) {
/* Type your code here. */
}
}

DAT210 Week 2 Java LAB 3.18 Driving costs Results

Double click on above image to view full picture

Zoom Out
Zoom In

More Views

  • DAT210 Week 2 Java LAB 3.18 Driving costs
  • DAT210 Week 2 Java LAB 3.18 Driving costs Results
$7.00

Details

DAT/210 Week 2 Java LAB 3.18: Driving costs

Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as input, and output the gas cost for 20 miles, 75 miles, and 500 miles.
Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
System.out.printf("%.2f", yourValue);
The output ends with a newline.

Ex: If the input is:
20.0 3.1599
the output is:
3.16 11.85 79.00

Note: Real per-mile cost would also include maintenance and depreciation.

import java.util.Scanner;

public class LabProgram {
public static void main(String() args) {
/* Type your code here. */
}
}

Additional Information

Special Price $3.00

Product Tags

Use spaces to separate tags. Use single quotes (') for phrases.

[profiler]
Memory usage: real: 18350080, emalloc: 17941104
Code ProfilerTimeCntEmallocRealMem