301038 PP  ­  PRACTICAL EXERCISES     Due at Midnight Fri Sep 14 2018

Released on 6/8/2018, last modified and finalised on xx

PREAMBLE 1. Over the semester, you will be working in a group of two, but this 1st assignment is an individual one. 2. This assignment 1 is worth 20% of the total marks for this Unit, and it is composed mainly of the questions taken directly from the covered chapters of the prescribed textbook.

3. Quality of the work, including such as proper program design and coding style and documentation/comments, will also be a major factor of consideration for the top grades.

4.  It is best that the assignment questions below corresponding to each chapter in the textbook be worked on and solved during the lab practical for that chapter, or in the next few days immediately afterwards.

QUESTIONS 1. (PP 1.10, p.82) (2 marks) Write a program that displays the word “HI” in large block letters. Make each large letter out of the other character as shown below.

III III HHHHHHHHHHH III III HHH III III HHH IIIIIIIIIIII HHH III III HHH III III HHH III III HHHHHHHHHHH

2. (PP 2.4 p.135) (3 marks) Write a program that prompts for and reads a course name, its credits and reference book. Then print the following paragraph, inserting the appropriate data:

This semester, a new course on course_name has been added to the curriculum. It consists of credits credits and the reference book for this course is reference_book.

3. (PP 3.8, p.184, modified) (3 marks) Write a program that generates two random integers in the range 1 to 21, inclusive, and displays the sine and cosine of the sum of those two integers.

4. (PP 4.6, p.229) (4 marks) Write a class called Shelf that contains instance data that represents the length, breadth, and capacity of the shelf. Also include a boolean variable called occupied as instance data that represents whether the shelf is occupied or not. Define the Shelf constructor to accept and initialize the height, width, and capacity of the shelf (height/width here in the textbook should refer to length/breadth). Each newly created Shelf is vacant (the constructor should initialize occupied to false). Include getter and setter methods for all instance data. Include a toString method that returns a one­line description of the shelf. Create a driver class called ShelfCheck, whose main method instantiates and updates several Shelf objects.

5. (3 marks) Use a while loop, a for loop and a do­while loop to calculate separately the following sum sin(3 + 4/(5*6)) + sin(4 + 5/(6*7)) + sin(5 + 6/(7*8)) + … + sin(96 + 97/(98*99))

Store the results in 3 separate variables and display their values before the program ends. 6. (PP 4.9, p.229) (5 marks)

Using the Die class defined in Chapter 4, write a class called WideDie, which can be regarded as a modification of the Die class, so that the die value will range from 1 to 10 (inclusive).

//******************************************************************** // Die.java Author: Lewis/Loftus //https://staff.scem.uws.edu.au/~zhuhan/pprof/assignments/Die.java

// Represents one die (singular of dice) with faces showing values // between 1 and 6. //******************************************************************** public class Die { private final int MAX = 6; // maximum face value private int faceValue; // current value showing on the die //—————————————————————– // Constructor: Sets the initial face value. //—————————————————————– public Die() { faceValue = 1; } //—————————————————————– // Rolls the die and returns the result. //—————————————————————– public int roll() { faceValue = (int)(Math.random() * MAX) + 1; return faceValue; } //—————————————————————– // Face value mutator. //—————————————————————– public void setFaceValue(int value) { faceValue = value; } //—————————————————————– // Face value accessor. //—————————————————————– public int getFaceValue() { return faceValue; } //—————————————————————– // Returns a string representation of this die. //—————————————————————– public String toString() { String result = Integer.toString(faceValue); return result; } }

Then write a class called DoubleDice, composed of two WideDie objects. Include methods to set and get the individual die values, a method to roll the dice, and a method that returns the (non­ negative) difference of the two die values. Create a driver class to instantiate and use a DoubleDice object and illustate the use of all your implemented features. Note: do not directly modify WideDie itself into the DoubleDice class, as this is not what the question is asking for. Calculate the average difference of the die values (the difference between the two dice of a DoubleDice object) for throwing 10, 100, 1000 double­dice respectively.

SUBMISSION The submission should contain all the Java source code, in files directly compilable, and a Microsoft Word document that, question by question, list the Java source code (not as screen shots) as well as the screen shots of the corresponding execution result. Please note that the screen shots must be easily readable when printed out.

Zip (don’t use the rar compression format) all the relevant files into a single zip file, and then upload it via the submit button on the unit website. it’s each student’s responsibility to keep the submission receipt which will be automatically generated after each submission.https://staff.scem.uws.edu.au/cgi-bin/cgiwrap/zhuhan/suite/sub-c.pl?unitname=Programming%20Proficiency

All papers are written by ENL (US, UK, AUSTRALIA) writers with vast experience in the field. We perform a quality assessment on all orders before submitting them.

Do you have an urgent order?  We have more than enough writers who will ensure that your order is delivered on time. 

We provide plagiarism reports for all our custom written papers. All papers are written from scratch.

24/7 Customer Support

Contact us anytime, any day, via any means if you need any help. You can use the Live Chat, email, or our provided phone number anytime.

We will not disclose the nature of our services or any information you provide to a third party.

Assignment Help Services
Money-Back Guarantee

Get your money back if your paper is not delivered on time or if your instructions are not followed.

We Guarantee the Best Grades
Assignment Help Services