Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

1 PROG2007 Assignment 1 Weight: 20% of your final mark Due: 9th of August XXXXXXXXXX:00 pm Specifications Your task is to complete various exercises in BlueJ, using the Java language, and to submit...

1 answer below »
1
PROG2007 Assignment 1
Weight: 20% of your final mark
Due: 9th of August XXXXXXXXXX:00 pm
Specifications
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.
Marking criteria includes:
• Use of co
ect coding style, including the use of comments;
• Accuracy of coding;
• Use of suitable coding structures;
• Co
ect submission and naming conventions of assessment items as required.

Please note that all instructions in this assignment must be followed EXACTLY, including the
names you are instructed to use. Failure to do so will result in a loss of marks. The reason for
this is as a programmer, you will often work as part of a team and will be required to follow
design documentation. If the design parameters are not followed precisely, bugs will be
introduced into the software when all of the individual components of the program are
assembled.
Getting Help
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.
Who can you get help from? Use this diagram to determine from whom you may seek help
with your program.
Lecturer

Tutors
Online
Forums
Relatives
Students
outside unit
Hired
coders
Classmates
Private
Tutors

Other
Encouraged
Attribution Required
Ask tutor
Not acceptable
2
Assignment Q1
To be completed in week 1
Create a new Microsoft Word document and call your document as YourFirstNameLastName-
A1Q1.docx.
Open the house project from chapter 1 of the reference book projects.
Open the terminal window and record method calls.
Create a picture with at least seven (7) objects (circle, square, triangle, and person), recording
all method calls.
Take a screenshot of your picture and add it to the word document you created earlier. Then
copy the list of method calls needed to create the picture and paste them in the word
document after the screenshot.
Add your name and student ID in the footer of the word document, as well as "PROG2007
Assignment 1 Q1".
Assignment Q2
To be completed in week 2
Create a new BlueJ project called YourFirstNameLastName-A1Q2.
Create a class called Worker.
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.
Add definitions for the following fields:
• A name field of type String
• An workerId field of type int
• A wage field of type double
• A fullTime field of type boolean
Write a constructor for your Worker class that takes four parameters - the first of type String
called myName, the second of type int called myWorkerId, the third of type double called
myWage, and the fourth of type boolean called isFullTime. Set the initial values of the
co
esponding fields using the constructor.
Write an accessor method called getName that returns the value of the name field.
3
Write a mutator method called setWorkerId that takes a single parameter of type int and sets
the value of the employeeId field.
Work out what other accessor and mutator methods would be useful for this Class and add
them. You should be able to get and set all fields in the Class.
Write a method called printDetails, which prints out all the details of an Worker object. You
must take into account the fullTime status and print a line saying either that the employee is
fulltime or the employee is not fulltime.
For example, if:
• The name field holds the value "John Smith"
• The workerId field holds the value 123456
• The wage field holds the value 25.40
• The fullTime field holds the value false
Then the printDetails method would print out the following:
The name of the worker is John Smith. The worker id is XXXXXXXXXXThe wage of the worker is
$25.40 per hour. The employee is not full-time.
If the full-time field holds the value True, then the printDetails method would print out the
following:
The name of the worker is John Smith. The worker id is XXXXXXXXXXThe wage of the worker is
$25.40 per hour. The worker is full-time.
Please Note: In the above examples, the name, workerId, wage and whether the worker is
full-time or not (in blue) will change based on the values the fields hold. However, you must
print the remainder of the statements exactly as in the above examples.
Assignment Q3
To be completed in week 3
Create a new BlueJ project called YourFirstNameLastName-A1Q3.
Create a class, Assignment, that contains the following four fields:
• A String called studentName
• A double called assignmentMark (which will store the mark each assignment is worth
e.g. for this assignment that you are doing right now the value would be 20)
4
• A double called studentMark (stores the mark the student gets in the assignment e.g.
15)
• A String called grade
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 takes and sets the studentName, studentMark and
assignmentMark.
Also define a constructor that takes no parameters and sets the assignmentMark to 100.
Create an accessor and mutator for studentMark. The mutator should not let the
studentMark be set a value greater than the assignmentMark (as the student cannot get a
mark higher than the assignment is worth) or less than 0. If the user tries to set a value that
is not valid a suitable e
or message should be displayed.
Create a method that calculates the grade for the student. You will need to work out how
many percent the student scored in the assignment.
If the student scored:
• Less than 50% the grade will be fail
• 50% - 64% the grade will be pass
• 65% – 74% the grade will be credit
• 75% – 84% the grade will be distinction
• Greater than 85% the grade will be high distinction
For example, if assignmentMark is 30 and studentMark is 15, the percentage will be 50% so
the grade will be set to pass.
Define an accessor method to return the value of grade.
Assignment Q4
To be completed in week 4
Create a new BlueJ project called YourFirstNameLastName-A1Q4.
Create a class called ListOfThings, that has one A
ayList field called things, which holds a
collection of Strings (each string is a name of an object in Upper case e.g. CAR or PLANT).
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.
5
Define a constructor that initialises the A
ayList. Note that you can also 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. Add a test for all three of these methods to check whether the operation was
successful and print a message letting the user know if it was or was not.
Create a method called printThings. This method should loop through the collection and print
out the elements (each String on a new line) as determined by the following rules:
• If the string contains any vowels (A, E, I, O and U), the method should print "The object
" + the value of the String + " contains vowels, and the vowels are:" + list of the vowels
in the string. The string may have more than one vowels. For example, if the name is
BIKE it would print: The object BIKE contains vowels, and the vowels are: I E
• If the string contains duplicate characters, the method should print "The object " + the
value of the String + " has the following duplicate character(s):" + list of the duplicate
characters in the string. The string may have one or more duplicate character. For
example, if the object is RACETRACK, it would print: The object RACETRACK has the
following duplicate character(s): R A C
• If the string contains any vowels (A, E, I, O and U), and it has duplicate characters, the
method should print "The object " + the value of the String + " contains vowels and
has duplicate characters". For example, if the object is PIZZA it would print: The name
PIZZA contains vowels and has duplicate characters.
• If none of the above criteria is met, then the method should print the String element
in lower case. For example, if the object is SKY, it would print: sky
Once you have finished your project, open the terminal window in BlueJ and turn on record
method calls.
Answered 26 days After Aug 05, 2021

Solution

Aditya answered on Sep 01 2021
160 Votes
New folde
Assignment.java
New folde
Assignment.java
public class Assignment {
    
    private String studentName;
    private double assignmentMark;
    private double studentMark;
    private String grade;
    
    public Assignment(String studentName, double assignmentMark, double studentMark)
    {
        this.studentName = studentName;
        this.assignmentMark = assignmentMark;
        this.studentMark = studentMark;
    }
    
    public Assignment() 
    {
        assignmentMark = 100;
    }
    
    public void calculates() 
    {
        double mark = (studentMark/assignmentMark) * 100;
        if(mark<50) 
        {
            grade = "fail";
        }
        else if(mark >= 50 && mark <= 64) 
        {
            grade = "pass";
        }
        else if(mark >= 65 && mark <= 74) 
        {
            grade = "credit";
        }
        else if(mark >= 75 && mark <= 84) 
        {
            grade = "distinction";
        }
        else 
        {
            grade = "high distinction";
        }
    }
    public String getGrade()
    {
        return grade;
    }
    
    
}
New folde
Clock.java
New...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here