Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

System.out.print (\"Enter song MDU songNum = stdIn.nextLine(); 5. cInsert code h

ID: 3605535 • Letter: S

Question

System.out.print ("Enter song MDU songNum = stdIn.nextLine(); 5. cInsert code here.> System.out.println (song) ) I/ end main ) I/ end class ExtractLine Sample session: Enter song number: 3 3. Dave Matthews Band Crash Into Me 7. S but it's OK if your column width produces the below output. Try to mimic the output's format precisely vary slightly from the shown column widths. 8. after $5.7] Given the below program skeleton. Replace the four cadd code heres items so that the progras public class CarInventoryReport or public static void main(String[] args) (The 10. State Syst 11. Progr tinal string HEADING FMT_STR cadd code here> final string DATA-FMT-STR-add code here>; string iteml "Mazda RX-8 int gtyl1-10 double pricel 27999.99 string item2-"MINI Cooper"; int qty2-100; double price2 “ 23000.25; Du: stem.out.printt (HEADING_ FMT_STR, Item. "Quantity" "Price", "Value"): system.out printf (HEADING FMT STR,

Explanation / Answer

//Added code the missing parts in the program

//CarInventoryReport.java
public class CarInventoryReport
{  
   public static void main(String[] args)
   {      
       //string format
       //- for left justification
       //integer value for width specification      
       final String HEADING_FMT_STR="%-25s%-13s%-13s%-13s ";
       //, for three digit group separation
       final String DATA_FMT_STR="%-25s%,-13d%-13.0f%,-13.0f ";

       //Set data values
       String item1="Mazda RX-8";
       int qty1=10;
       double price1=27999.99;
       //Set data values
       String item2="MINI Cooper";
       int qty2=100;
       double price2=23000.25;
      
       //display the output
       System.out.printf(HEADING_FMT_STR,"Item","Quantity","Price","Value");
       System.out.printf(DATA_FMT_STR,item1,qty1,price1,qty1*price1);

       System.out.printf(DATA_FMT_STR,item2,qty2,price2,qty2*price2);
      
      
   }

}

------------------------------------------------------------------------------------------

Sample Output :

Item Quantity Price Value
Mazda RX-8 10 28000 280,000
MINI Cooper 100 23000 2,300,025