Question: Construct UML class diagrams for the Computer and ComputerDriver classes in Exercise 6. Exercise 6 Given this Computer design program: Use the following trace setup

Construct UML class diagrams for the Computer and ComputerDriver classes in Exercise 6.

Exercise 6

Given this Computer design program:

1 2 3 *Dean & Dean 4 5 *This exercises the Computer class. ***** 6 7 8 1 2 9 ( 10 11 12 3 4 5 6 7 8

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.

input Intel 80000000000 Driver main line# myPc line# aProc aRSize this this Computer assignDiskSize cCost

1 2 3 *Dean & Dean 4 5 *This exercises the Computer class. ***** 6 7 8 9 ( 10 11 12 3 4 5 6 7 /********* * Computer Driver.java 8 9 * public class Computer Driver 13 14 15 16 17 18 19) end class Computer Driver 1 /********** 2 19 20 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.print Specification(); 3 // end main * 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.util.Scanner: - private long ramSize (long) 1000000000.0; private long diskSize: private double cost; //****** public void assignProcessor () ( 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; 3 // end assignRamSize //***** 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 print Specification *********** **************************** ********* 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.43 Rating (162 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

1 Input Values Processor Intel RAM Size 80000000000 2 Driver main myPc is ins... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Introduction To Programming With Java A Problem Solving Approach Questions!