Write a constructor for your Employee class

Assignment Help JAVA Programming
Reference no: EM132851335

PROG2007 Programming - Southern Cross University

Your task is to complete various exercises in BlueJ, using the Java language.

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 six (6) 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 Employee.
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 employeeId field of type int
• A wage field of type double
• A fullTime field of type boolean

Write a constructor for your Employee class that takes four parameters - the first of type String called myName, the second of type int called myEmployeeId, the third of type double called myWage, and the fourth of type boolean called isFullTime. Set the initial values of the corresponding fields using the constructor.

Write an accessor method called getName that returns the value of the name field.

Write a mutator method called setEmployeeId 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 Employee 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 employeeId 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 employee is John Smith. The employee id is 123456. The wage of the employee is $25.40 per hour. The employee is fulltime.
If the fulltime field holds the value false, then the printDetails method would print out the following:
The name of the employee is John Smith. The employee id is 123456. The wage of the employee is $25.40 per hour. The employee is not fulltime.

Please Note: In the above examples, the name, employeeId, wage and whether the employee is fulltime 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)

• 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 error 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 ListOfNames, that has one ArrayList field called names, which holds a collection of Strings (each string is a male or female name in Upper case e.g. PETER).

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 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 printNames. 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 name " + 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 EMMA it would print: The name EMMA contains vowels, and the vowels are: E, A
• If the string contains duplicate characters, the method should print "The name " + 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 name is ANNABELLA, it would print: The name ANNABELLA has the following duplicate character(s): A, N, L
• If the string contains any vowels (A, E, I, O and U), and it has duplicate characters, the method should print "The name " + the value of the String + " contains vowels and has duplicate characters". For example, if the name is LARISSA it would print: The name LARISSA 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 name is SKY, it would print: sky
Once you have finished your project, open the terminal window in BlueJ and turn on record method calls. Create a new ListOfNames object, and then add at least ten (10) Strings using the add method you wrote. You must have:

• A String that contains vowels
• A String that has duplicate characters
• A String that contains vowels and has duplicate characters
Demonstrate removing an element using the remove method you wrote, and then find the number of elements using the method you wrote that gets the number of elements. Finally, run your printNames method.
Copy all your calls into a text file called YourFirstNameLastName-A1Q4-example.txt and save it in your BlueJ project folder.

Assignment Q5

To be completed in week 5
Part A:

Imagine you need to write a program for a 24-hour clock with hours, minutes and seconds. Write a Java program in BlueJ with a method that prints all possible times the clock could display starting at 00:00:00 through to 23:59:59 when all the three numbers are the same (e.g. 01:01:01, 02:02:02, 13:13:13 and so on)
Part B:

Write a second method that takes three (3) parameters - hours, minutes and seconds. This method will print out all of the possible times the clock could display from one hour before the time passed to the method till one hour after the time passed to the method when all the three numbers are even (e.g. 12:20:00 or 12:20:02, NOT 12:20:01). For example:

If the method was passed the following values: Hour = 11
Minutes = 23

Seconds = 44

The method would print all the times the clock could display from 10:23:44 until 12:23:44 when all the three numbers (hours, minutes and seconds) are even. The first printed time would be 10:24:00, and the last one would be 12:22:58)

Attachment:- Programming.rar

Reference no: EM132851335

Questions Cloud

Why issue is important to the global community : Why issue is important to the global community. What outside influences might help change this issue? How? Is the article neutral? Why or why not?
What is the probability that the sample mean : A population hass=16n=64If selected from this population, what is the probability that the sample mean will be within ±2 of the population mean?
Explain 360-degree best practices and implementation plans : Explain 360-degree best practices and implementation plans. Explain how you will use feedback with your own employees in your future career.
Discuss the signs of glands of the endocrine system : Choose one glands of the endocrine system besides the pituitary and the hypothalamus gland and discuss the signs and symptoms
Write a constructor for your Employee class : Write a constructor for your Employee class that takes four parameters - the first of type String called myName, the second of type int called myEmployeeId
Why are dietitians concerned with saturated and unsaturated : Why are dietitians concerned with saturated and unsaturated fatty acids? List the three main structural components of a typical cell?
Describe how the endocrine system affect behavior : Describe how the endocrine system affect behavior? Explain. What do you think is correct or incorrect about your partner's choices.
What is the staff nurse role in evidence-based practice : What is the staff nurse's role in evidence-based practice in your organization? How much do you think evidence-based practice is valued by your colleagues
What is the chance that the pet store gets exactly one blue : If the supplier selects the parakeets at random, what is the chance that the pet store gets exactly one blue parakeet?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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