CSC72003 - Programming Assignment

Assignment Help JAVA Programming
Reference no: EM132487769

CSC72003 - Programming Assignment - Southern Cross University, Australia

Task - Your task is to complete various exercises in BlueJ, using the Java language, and to submit these via the MySCU link created for this purpose.

This assignment is to be completed individually. It is the opportunity to gain an understanding of the concepts of object oriented programming and coding syntax. It is important that you master these concepts yourself. You are permitted to work from the examples in the study guide or textbook but you must acknowledge assistance from other textbooks or classmates. In particular, you must not use online material or help from others, as this would prevent you from mastering these concepts.

Question 1 -

Create a word document and call your document username-A1Q1.docx. For example, mine would be nfrancis10-A1Q1.docx

Open the house project from chapter 1 of the book projects.

Open the terminal window and tick the record method calls.

Create a picture with at least two (2) objects of circle, two (2) objects of square, two (2) objects of triangle, and two (2) objects of person, recording all method calls.

Use the methods provided to divide the objects into two groups, each group must only have one type of object. For example, a group must have a circle, a square, a triangle and a person.

Take a screenshot of your picture and add it to the word document you created earlier.

Now copy the list of method calls needed to create the picture to the word document after the screenshot.

Question 2 -

Create a new BlueJ project called username-A1Q2. For example, mine would be nfrancis10-A1Q2. Click on New Class and give the class a name of Book. Make sure "Java" and "class" are selected.

Write a description of your new Class in the top comments. Make sure you put in your name as the author and the date as the version you last worked on this exercise.

Add 2 fields that are suitable for a book. One field should have a type of int, the other should have a type of String.

Add a third double field called rating. A rating has a range between 0.0 to 5.0. Bigger than 4.0 is a top seller.

Write a constructor for your Book class that takes two (2) parameters - the first of type int, the second of type String. Set the initial values of the first 2 fields that you created using the parameters.

Write accessor methods for all 3 of your fields.

Write mutator methods for all 3 of your fields.

Write a method called printDetails, which prints out all the details of a Book object. Please have a look at the 'Printing' section in the Topic 2 study guide to see how to do this.

Take into account the rating status. The printDetails method should have an if-else statement that prints a line saying that the Book is a top seller or not.

Question 3 -

Create a new BlueJ project called username-A1Q3. For example, mine would be nfrancis10-A1Q3. Create a class called Vehicle, that contains five fields, current speed, power, accelerate, decelerate and top speed, all of which type is int.

Make sure you write a description of your new Class in the comments, with your name as author and date as the last date you worked on this exercise.

Define a constructor that takes and sets the accelerate, decelerate; sets the power to 20, and top speed to 120. Leave the current speed as 0.

Also define a constructor that takes no parameters. The power field should be set to the value of 30 in this constructor, top speed to 160, and accelerate and decelerate to reasonable amounts. Leave the current speed as 0.

Define the mutators speed up and brake, whose effect is to increase or decrease the value of current speed by the (power + accelerate) and (power + decelerate) respectively. The mutator methods should not let the current speed to be set to a value higher than the top speed, or lower than zero.

Add a mutator method that sets the value of the power. Add a check to make sure that the new power value is not set higher than 50 or lower than 10.

Define an accessor method to return the value of current speed.

Test your work. Zip the project and include in your assessment files.

Question 4 -

Create a new BlueJ project called your username-A1Q4. For example, mine would be nfrancis10-A1Q4.

Before you start to code, make sure to enable the "record method calls" in the BlueJ terminal.

Create a class called VeggieBasket, that has one ArrayList field called vegetables, which holds a collection of Strings.

Make sure you write a description of your new Class in the comments, with your name as author and give the version as the date you last worked on this exercise.

Define a constructor that initialises the ArrayList. Note that you can add any other initialisations that you feel are relevant.

Create methods to add elements, remove elements and get the number of elements in the collection. Make sure you add tests for errors and sensible error messages.

Create a method called printVeggies. This method should loop through the collection and print out the elements (each String on one line) as determined by the following rules;

- If the vegetables has a total letter less than 6, instead of printing the vegetable name, it should print "Gollum".

- If the vegetable starting letter begin with a vowel, instead of printing the vegetable name, it should print "Frodo".

- If both conditions above are satisfied, it should print "Legolas".

- If none of the prior criteria are met, then the method should print "Gandalf".

Write a method countNames that prints each name that appeared with its total counts. (e.g. Gollum:2, Frodo:3, Legolas:1, Gandalf:4)

Once you have finished your project, clear the terminal window in BlueJ and record the following. Add at least ten (10) Vegetables inside the ArrayList using the add method you wrote. You must have vegetables that satisfy all of the printVeggies conditions.

Demonstrate removing an element using the remove method you wrote, and then find the number of elements using your method. Finally, run your printVeggies method. Copy all your calls into a text file (.txt) and save it in your BlueJ project folder.

Question 5 -

Create a new BlueJ project called your username-A1Q5. For example, mine would be nfrancis10-A1Q5.

Inside the project you will need to create two classes, which is PartA and PartB.

Part A: Imagine you need to open a standard three digit combination dial lock. Write a Java program in BlueJ with a method that prints all of the possible combinations. If the three digits combination have all the same number, replace it with "jackpot". Assume the numbers on each dial range from zero to nine and three numbers in sequence are needed to open the lock. For example, the output would look like:

0-0-0 -> "jackpot"

0-0-1

0-0-2 ->

// lots more combinations

9-9-8 ->

9-9-9 -> "jackpot"

Part B: Suppose the lock isn't a very good one and any number that's no more than one away from the correct number in each digit will also work.

Write another method that takes 3 parameters of type int that are the combination of the lock. The method will print out a minimal list of combinations you would need to try to guarantee opening the lock.

For example, if the combination is 7-6-3 then 7-5-4, 6-6-2, 8-5-3 and other combinations will also open the lock. The first combination printed would be 6-5-2 and the last would be 8-7-4. You will also need to make sure that no number in the combinations that are printed is less that zero and greater than nine as the numbers on each dial range from zero to nine.

Attachment:- Programming Assignment File.rar

Reference no: EM132487769

Questions Cloud

Should elena include on the balance sheet : Should Elena include on the Balance Sheet? Ribs on the Run has $200 of insurance, which Uncle Eddie prepaid for at the time Elena
Calculate the book value at the end of year : Calculate the book value at the end of year. A machine that cost$136,000 has an estimated residual value of $8,000 and an estimated useful life of 8 years.
Determine the interest payment for the three bonds : Determine the interest payment for the following three bonds. (Assume a $1,000 par value.) (Round your answers to 2 decimal places.)
What is the taxable equivalent yield on a municipal bond : What's the taxable equivalent yield on a municipal bond with a yield to maturity of 3.1 percent for an investor in the 28 percent marginal tax bracket?
CSC72003 - Programming Assignment : CSC72003 - Programming Assignment Help and Solution - Southern Cross University, Australia. Complete various exercises in BlueJ, using the Java language
What will be the change in the percentage terms : What will be the change in the percentage terms? (Do not round intermediate calculations. Round your final answer to 2 decimal places.)
Wacc-bartlett company : Bartlett Company's target capital structure is 40% debt, 15% preferred, and 45% common equity. The after-tax cost of debt is 6.00
Explain important skills required of forensic accountants : List and explain the most important skills required of forensic accountants. How do these apply to you? Which ones are you missing? Which ones do you need furth
What is the par value of the preferred stock : If dividends of $73,000 were in arrears on preferred stock, what would be the balance reported for retained earnings? What is the par value of preferred stock?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Create a RESTful service to perform CRUD operations

COMP-303 Java EE Programming Assignment - RESTful Service and Client with JSON, Centennial College, Canada. Create a RESTful service to perform CRUD operations

  Main method to test your class with at least three hot dog

Need a constructor that allows a user of the class to initialize both values. Also need a method named JustSold that increments the number of hot dogs the stand

  Write a program that display a menu student can select from

Write a program that will help a student practice basic math (addition, subtraction, multiplication, and division). Display a menu the student can select from.

  Calculates the total annual compensation of a salesperson

calculates the total annual compensation of a salesperson

  Design implement test and debug a program with a jframe

design implement test and debug a program with a jframe that allows the user to enter a series of contacts names ages

  Develop the game using the concepts of cohesion

Develop the game using the concepts of Cohesion, Coupling and RDD, i.e., responsibility-driven design.

  1 create a recursive factorial program that prompts the

1. create a recursive factorial program that prompts the user for an integer n and writes out a series of equations

  Write a method, insertat that takes four parameters

Write a method, insertAt that takes four parameters

  Write a java gui application to do temperature conversions

Write a Java GUI application to do temperature conversions between Celcius, Fahranheit, and Kelvin

  Discuss a website that utilizes json

A website that utilizes JSON. Review the website source, and evaluate how the author created the pages - Identify what you liked or did not like

  Write a method which reverses the order of items

Write a method static void reverse (List l) which reverses the order of items stored in the list. Again, make sure it works for any special cases you can think of - write a series of statements to create several AList and/or LList objects (of typ..

  Construct a java program that performs given conversions

Construct an object-oriented Java program that performs each of the following conversions. Note that we're only dealing with non-negative numbers.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd