computers

This assignment provides you an opportunity to practice

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper
  • creating a class that includes attributes and the methods that are included in a class to support object oriented programming such as constructors, sets, gets, and a method to print out all attributes.
  • creating a class that includes an attribute that is another class type and methods that support those attributes.
  • illustrating the use of the “this” reference with constructors, instance variables and instance methods.
  • demonstrating the use of composition in OOP.
  • identifying and using Java classes which are related to strings and their methods.

Directions

Please solve five (5) programming problems related to the content presented in Chapters 9, 10 and 4 in your text. You can find the programming problems in the attached file (

Module 3 Programming Problems Worksheet x

 (Links to an external site.)).

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper
  • Download the worksheet and save it as
  • Mod3-Worksheet-Programming-Last-First x.
  • For example, Mod3-Worksheet-Programming-Smith-John x.

  • Consider the problem, design an algorithm (or algorithms) that would solve the problem, and then implement the algorithm in Java.
  • Create a new folder and name it as Mod3-Java-Programming-Last-First, for example, Mod3-Java-Programming-Smith-John.
  • Write the source code for each problem and save them as .java files in the folder you created. There are five programming problems for this module so you should have five .java files. Name your java files as Mod3Problem#.java, for example, Mod3Problem1.java.
  • Please insert the algorithm written in pseudocode as a comment in the beginning of your program.
  • Take screenshots of your running program – you can take screenshots using PrintScreen or any tool that you are familiar with, making sure that the console window in which you run the program appears on the screen.
  • Copy the screenshots in the worksheet. If your program has different outcomes, take screenshots of each variation.

Submission

  • Compress the folder that saves all of your java files as .zip file. Please note don’t save the worksheet in the same folder as they need to be submitted separately.
  • Submit the following two files as attachments by clicking the Submit Assignment button above.
  • Mod3-Java-Programming-Last-First.zip.
  • Mod3-Worksheet-Programming-Last-First x.

Grading

This assignment is worth 55 points. You can find the grading rubric for each program in the worksheet attached above.

  • High School Locker (15 points).
  • Cycle (10 points).
  • Book (10 points).
  • Builder (10 points).
  • CharacterArray (10 points).

ELI CSC

2

0

1

Unit

3

Programming Problems Worksheet

Programming Problem 1 – High School Locker

A locker for a high school student has a locker number, a student name assigned to it, a number of books stored inside the locker, and also a combination lock. The lock is constructed with a combination that has 3 numbers between 0 and 39. The lock is opened if the user turns the lock to the right to the first combination number, and then left to the second combination number, and then right to third combination number. When the dial is reset it will then be pointing to 0.

Create a class to represent the locker and another class to represent the combination lock. The Locker class will include an attribute that is of type CombinationLock. Each class must include a constructor with no input argument and also a constructor that requires input arguments for all attributes. Each class must include the appropriate set and get methods. Each class must include a method to print out all attributes.

The CombinationLock class must include the following problem specific methods:

· A method named resetDial that resets the dial to position 0.

· A method named turnLeft that will turn the dial to the left a certain number of ticks from the current position. The number of ticks to turn will be passed as an input argument to this method.

· A method named turnRight that will turn the dial to the right a certain number of ticks from the current position. The number of ticks to turn will be passed as an input argument to this method.

· A method named openLock that will try to open the lock with a combination. The combination that is tried will be passed as three input arguments to this method. This method will return true if the lock opens successfully and will return false if the lock is not opened successfully.

The Locker class must include the following problem specific methods:

· A method named putBookInLocker that puts one additional book into the locker. This method does not take any input arguments and does not return a value.

· A method named removeBookFromLocker that tries to remove one book from the locker. This method does not take an input argument, but does return a value. The book returns true if the book is removed successfully and returns false if the book is not removed successfully.

· A method named openLocker that will try to open the locker. This method will prompt the user to input the three numbers in the combination to try. This method will print out the success or failure of opening the locker.

The main method will be in a separate class from the Locker and the CombinationLock classes. This main method must complete the following:

· Creates locker number 100 for Mickey Mouse. The combination for this locker is 28, 17, 39. This locker will include 3 books.

· Create locker number 275 for Donald Duck. The combination for this locker is 35, 16, 27. This locker will include 0 books.

· Try to open the locker for Mickey Mouse using 15, 18, 18.

· Add three books to Mickey Mouse’s locker.

· Remove one book from Donald Duck’s locker.

· After all of these actions have been completed, print out the current state of both lockers to the console.

Directions

· You may only use statements that are discussed in the book through Chapter 10.

· Console input and output must be used to solve this problem.

Grading Rubric

1

1

1

1

1

1

1

1

1

1

2

Task

Points

CombinationLock – attributes

1

CombinationLock – constructor

CombinationLock – resetDial

CombinationLock – turnLeft

CombinationLock – turnRight

CombinationLock – openLock

Locker – attributes

Locker – constructor

Locker – putBookInLocker

Locker – removeBookFromLocker

Locker – openLocker

Main method

2

Console output

Total

15

Screenshots

Programming Problem 2 – Cycle

[A] Create a class called “Cycle” which has two instance integer variables as properties, “numberOfWheels” and “weight.”  Create a constructor with two parameters, using the same variable names in the parameter list.  Assign each variable to numberOfWheels” and “weight” respectively.  Write a separate application to test the class and display its properties. Note: Do not change the names of the instance variables or the variables listed in the constructor’s parameter list.

[B] Edit your class Cycle by adding a default constructor which will assign the default values of 100 to represent the numberOfWheels, and 1000 to represent the weight, by invoking a call to the other constructor.  Modify your application created in [A] to test the class.

Directions

[A] Create a class called Cycle

· Declare integer instance variables numberOfWheels and weight as private.

· Include a toString() method in the Cycle class.  No set or get methods are included.

· Create a constructor with two parameters, using the same variable names numberOfWheels and weight in the parameter list. Complete the constructor as necessary.

· Create a separate application to test the class.

· Create an object of the Cycle class.

· Display the properties of the object.

[B] Add a default constructor

· Edit the default constructor such that the default constructor will invoke the existing constructor with the default values of 100 to represent the numberOfWheels, and 1000 to represent the weight. Invoke the constructor using the “this” reference.

· Create the second constructor which will receive the two arguments.

· Create a separate application to test the class.
· Create an object of the Cycle class.
· Display the properties of the object.

Grading Rubric

Task

Points

2

2

1

2

1

1

1

Class created and named

Constructor(s) completed correctly

toString() methods written correctly

Successful invocation (constructor to constructor)

Properties output correctly

Proper documentation / Pseudocode

Program works effectively

Total

10

Screenshots

Programming Problem 3 – Book

A Book has such properties as title, author, and numberOfPages. A Volume will have properties such as volumeName, numberOfBooks, and an array of book objects (Book [ ]). You are required to develop the Book and Volume classes, then write an application (DemoVolume) to test your classes. The directions below will give assistance.

Create a class called Book with the following properties using appropriate data types: Title, Author, numberOfPages, Create a second class called Volume with the following properties using appropriate data types: volumeName, numberOfBooks and Book [ ]. The Book [ ] contains an array of book objects.

Directions

· Create a class called Book with the following properties using appropriate data types: Title, Author, numberOfPages,

· The only methods necessary in the Book class, for this exercise, are the constructor and a toString().

· Create a second class called Volume with the following properties using appropriate data types: volumeName, numberOfBooks and Book [ ]. Book [ ] will contain an array of book objects.

· The only methods necessary in the Volume class, for this exercise, are the constructor, toString() and getBookArray(). The getBookArray returns a string of book properties for each book.

· Create an application called DemoVolume.

· In the main method,

· Create an array of book objects to be added to the volume.

· Create a volume object called volume1.

· Display the properties of volume1.

Grading

Task

Points

2

1

2

1

2

Proper documentation / Pseudocode

1

Program works effectively

1

Total

10

Book class properties created

Volume class created correctly

Constructors created correctly

“this” reference used effectively

Array of book objects created

Screenshots

Programming Problem 4 – Builder

Write a program which will accept a string from the keyboard, “Java is fun!” Your program must determine the capacity of the string. Then, append a second string, “I love it!” to the first string. At this point you will enter a string “Yes, “ and insert this string so that the output of the entire string will display “Java is fun. Yes, I love it!”

Directions

· Create a class called Builder.

· Using the StringBuilder class, write a program which will accept a string from the keyboard, “Java is fun!”

· Your program must determine and display the capacity of the string.

· Append a second string, “I love it!” to the first string.

· Require the user to enter a string “Yes, “

· Insert the string, “Yes ” at the correct location, such that the output of the entire string will be “Java is fun. Yes, I love it!”

· Display your output using clear and appropriate messages.

Grading

Task

Points

Class created and named

1

2

2

1

Proper documentation / Pseudocode

1

Total

10

String variables declared and initialized

Appropriate use of StringBuilder

Appropriate use of string methods

3

Appropriate messages displayed

Screenshots

Programming Problem 5 – CharacterArray

Write a program which will store the following string into a character array:

6901 Sudley Road Manassas VA

Your program will display each original character, determine and display whether the character is a digit or a letter, and redisplay the character according to the directions below.

Directions

· Create a class called CharacterArray.

·

The scanner class is not required. Initialize the character array with the given string.

· Write a program which will accept an alpha numeric string at the keyboard.

· Store the string, of any length, into a character array, for example:
NVCC Manassas Campus 6901 Sudley Road Manassas VA 20109

· For each visible character:

· Display the original character

· Determine and display whether the character is a digit or a letter

· If the character is a lower case letter, redisplay the character in upper case

· If the character is a upper case letter, redisplay the character in lower case

· If the character is a digit, display it as an * (asterisk)

· Display your output using clear and appropriate messages.

Grading

Task

Points

Class created and named

1

String variables declared and initialized

2

Original characters displayed

1

Appropriate use of string methods

2

Appropriate condition statements used

2

Appropriate messages displayed

1

Proper documentation / Pseudocode

1

Total

10

Screenshots

1

Calculate your order
Pages (275 words)
Standard price: $0.00
Client Reviews
4.9
Sitejabber
4.6
Trustpilot
4.8
Our Guarantees
100% Confidentiality
Information about customers is confidential and never disclosed to third parties.
Original Writing
We complete all papers from scratch. You can get a plagiarism report.
Timely Delivery
No missed deadlines – 97% of assignments are completed in time.
Money Back
If you're confident that a writer didn't follow your order details, ask for a refund.

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00
Power up Your Academic Success with the
Team of Professionals. We’ve Got Your Back.
Power up Your Study Success with Experts We’ve Got Your Back.

Order your essay today and save 30% with the discount code ESSAYHELP