Question: Given this Computer design program: Use the following trace setup to trace the Computer program. Note that we have used abbreviations to keep the trace
Given this Computer design program:

Use the following trace setup to trace the Computer 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.

1 2 3 *Dean & Dean 4 5 *This exercises the Computer class. ***** 6 7 8 13 14 15 16 17 18 19 1 2 9 ( 10 11 12 3 4 5 6 7 8 9 /********* * Computer Driver.java * 19 20 public class Computer Driver 21 22 23 24 public static void main(String[] args) ( Computer my Pc new Computer (); myPc.assignProcessor (); my Pc.assignRamSize(): my Pc.assignDiskSize(); my Pc.calculateCost (); my Pc.printSpecification(); 3 // end main / end class Computer Driver /********** * Computer.java Dean & Dean. * 31 32 10 public class Computer 11 ( * This class collects specifications for a Computer. ***** 12 private String processor: 13 14 15 16 17 18 import java.ut11.Scanner: - private long ramSize (long) 1000000000.0; private long diskSize: private double cost; //****** public void assign Processor () ( Scanner stdIn - new Scanner (System.in); this.processor = stdIn.nextLine(); } // end assignProcessor 25 26 27 public void assignRamSize() 28 ( 29 30 this.ramSize = (long) 3000000000.0; } // end assign RamSize //***** 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 public void printSpecification () 60 ( 61 62 63 64 65 66 // end class Computer public void assignDiskSize() { Scanner stdIn= new Scanner (System.in); long diskSize; diskSize = stdIn.nextLong (); } // end assignDiskSize //************** public void calculate Cost() ( this.cost = this.ramSize/ 20000000.0 + this.diskSize / 200000000.0; if (this.processor.equals("Intel")). ( this.cost += 200; } else ( this.cost + 150; } } // end calculate Cost //******** **/ **************************** } // end printSpecification *********** ********* System.out.println("Processor = "+ this.processor); System.out.println("RAM = " + this.ramSize); System.out.println("Hard disk size = " + this.diskSize); System.out.println("Cost = $" + this.cost);
Step by Step Solution
3.33 Rating (153 Votes )
There are 3 Steps involved in it
Java import javautilScanner public class Computer ... View full answer
Get step-by-step solutions from verified subject matter experts
