Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Complete this program to print a table of prices. The first column has width 8 and the second column has width 10. Print the prices
Complete this program to print a table of prices. The first column has width 8 and the second column has width 10. Print the prices with two digits after the decimal point. Complete the following file Table.java 1 import java.util.scanner; 3 public class Table 4 public static void main(String[] args) 6 Scanner in = new Scanner(System.in); System.out.print("Unit price: "); double price in.nextDouble); 8 10 12 13 14 15 16 17 System.out.println("Quantity int quantity = 1; System.out.printf("%8d %10.2f", quantity 12; System.out.printf("%8d %10 . 2f", quantity 100 System.out.printf("%8d %10 . 2f", Price"); quantity, quantity, quantity, quantity * quantity * quantity * price); price); price); 19 Submit Testing Table.java Test 1 Actual outputExpected output Unit price: 19.95 Unit price: 19.95 Quantity Price Quantity Price 19.95 12 239.40 108 1995.ee 19.95 12 239.4e 1e0 1995,08
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started