Problem

Given this PcDesign program:1 /********************************************************2 *...

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.calculateCost();17 myPc.printSpecification();18 } // end main19 } // end class PcDesignDriver

1 /***********************************************************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 void assignRamSize()20 {21 this.ramSize = (long) 2000000000.0;22 } // end assignRamSize2324 //********************************************************2526 void assignDiskSize()27 {28 Scanner stdIn = new Scanner(System.in);29 long diskSize;30 diskSize = stdIn.nextLong();31 } // end assignDiskSize3233 //********************************************************3435 void assignProcessor()36 {37 Scanner stdIn = new Scanner(System.in);38 this.processor = stdIn.nextLine();39 } // end assignProcessor4041 //********************************************************4243 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 calculateCost 5657 //******************************************************** 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 impact the final result.

input

60000000000Intel

Step-by-Step Solution

Request Professional Solution

Request Solution!

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.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 6
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT