Given this PcDesign program:
1 /********************************************************2 * PcDesignDriver.java3 * Dean&Dean4 *5 * This exercises the PcDesign class.6 ********************************************************/78 public class PcDesignDriver9 {10 public static void main(String[] args)11 {12 PcDesign myPc = new PcDesign();13 myPc. assignRamSize( );14 myPc. assignDiskSize( );15 myPc. assignProcessor( );16 myPc. calculatorCost( );17 myPc. printSpecification( );18 } // end main19 } // end class PcDesignDriver1 /***********************************************************2 * PcDesign.java3 * Dean&Dean4 *5 * This class collects specifications for a PC.6 ***********************************************************/78 import java.util.Scanner;910 public class PcDesign11 {12 private long ramSize = (long) 1000000000.0;13 private long diskSize;14 private String processor;15 private double cost;1617 //********************************************************1819 public void assignRamSize()20 {21 this.ramSize = (long) 2 000000000.0;22 } // end assignRamSize2324 //********************************************************2526 public void assignDiskSize()27 {28 Scanner stdIn = new Scanner(System.in) ;29 long diskSize;30 diskSize = stdIn.nextLong( );31 } // end assignDiskSize3233 //********************************************************3435 public void assignProcessor( )36 {37 Scanner stdIn = new Scanner(System.in);38 this.processor = stdIn.nextLine( );39 } // end assignProcessor4041 //********************************************************4243 public void calculateCost( )44 {45 this.cost = this.ramSize / 10000000.0 +46 this.diskSize / 100000000.0;47 if (this.processor.equals(“Intel”))48 {49 this.cost += 400;50 }51 else52 {53 this.cost += 300;54 }55 } // end calculateCost5657 //********************************************************5859 public void printSpecification( )60 {61 System.out.println(“RAM = “ + this.ramSize);62 System.out.println(“Hard disk size = “ + this.diskSize)63 System.out.println(“Processor = “ + this.processor);64 System.out.println(“Cost = $” + this.cost);65 } // end printSpecification66 } // end class PcDesign
Use the following trace setup to trace the PC-design program. Note that we have used abbreviations to keep the trace setup’s width as small as possible. Don’t forget to specify default and initial values, even if they don’t affect the final result.
input
60000000000Intel
Driver | PcDesign |
| |||||||||||
| main |
| ARSize | assignDiskSize | aProc | cCost | printS | obj1 | |||||
line# | myPc | line# | this | this | diskSize | this | this | this | ramSize | dSize | proc | Cost | output |
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.