Loading...

Messages

Proposals

Stuck in your homework and missing deadline? Get urgent help in $10/Page with 24 hours deadline

Get Urgent Writing Help In Your Essays, Assignments, Homeworks, Dissertation, Thesis Or Coursework & Achieve A+ Grades.

Privacy Guaranteed - 100% Plagiarism Free Writing - Free Turnitin Report - Professional And Experienced Writers - 24/7 Online Support

Write a class named parkingmeter containing:

16/11/2020 Client: arwaabdullah Deadline: 3 days

Exercise 1 [5 points]:

Create the following classes shown in the UML diagram. Then, create PointTest.java class with main method to test all functionality of these classes.

Exercise 2 [10 points]:

The following figure shows a UML diagram in which the class Student is inherited from the class

Person

a. Implement a Person class. The person constructor takes two strings: a first name and a last name. The constructor initializes the email address to the first letter of the first name followed by first five letters of the last name followed by @tru.ca. If the last name has fewer than five letters, the e-mail address will be the first letter of the first name followed by the entire last name followed by a @tru.ca. Examples:

Name

Email Address

Jane Smith

JSmith@tru.ca

Musfiq Rahman

MRahma@tru.ca

John Morris

JMorri@tru.ca

Mary Key

MKey@tru.ca

b. Override Object’s toString method for the Person class. The toString method should return the present state of the object.

c. Now, create a Student class that is a subclass of Person and implements Comparable interface.

d. The Student constructor will be called with two String parameters, the first name and last name of the student. When the student is constructed, the inherited fields lastName, firstName, and email will be properly initialized, the student’s gpa and number of credit will be set to 0. The variable lastIdAssigend will be properly incremented each time a Student object is constructed and the studentId will be set to the next available ID number as tracked by the class variable lastIdAssigend.

e. Override the object’s toString method for the Student class. The toString method should return the present state of the object. Note that it should use the toString() method from its superclass.

f. The addCourse() method should update the credits completed, calculate, and update the gpa value.

Use the following values for grade:

Example GPA calculation:

GRADE CREDIT CALCULATION

(A) 4.0 x 4 = 16.00

(B) 3.0 x 4 = 12.00

(B) 3.0 x 4 = 12.00

(A) 4.0 x 1 = 4.00

(C) 2.0 x 3 = 6.00

GPA = 50.00 / 16 = 3.125; the getGPA() method should return this value.

g. Students are compared to each other by comparing GPAs. Override the compareTo() method for the student class. Note that to override the compareTo() method, the Student class must implement Comparable interface.

Now, test your code with the supplied client code (StudentClient.java). Note: You should not modify this client code. We will use the same client code to test your classes.

Exercise 3 [10 points]:

In this exercise, you need to implement a class that encapsulate a Grid. A grid is a useful concept in creating board-game applications. Later we will use this class to create a board game. A grid is a two-dimensional matrix (see example below) with the same number of rows and columns. You can create a grid of size 8, for example, it’s an 8x8 grid. There are 64 cells in this grid. A cell in the grid can have any arbitrary value. Later in this course, we will learn how to create a cell that can hold any arbitrary values. However, for the time being, we will assume that the cell-values are non-negative integers. If a cell contains a value ‘0’ that means, the cell is empty. To identify a cell, you need row number and column number, for example, cell (1, 3) means 3rd cell of the

1st row. You need to create a class that satisfies the following requirements.

Tasks
Write tests and code for each of the following requirements, in order. The words in bold indicate message names. Whenever a requirement says the user can "ask whether...", the expected answer is boolean. Whenever a requirement speaks of a "particular" item, then that item will be an argument to the method.

1. The user can create a Grid specifying the number of row and column. Also the user can create a Grid specifying the size only.

2. The user can ask a Grid whether its isEmpty. A grid is empty when all the cells of the grid is empty.

3. The user can clear all the cells of the grid. It’s a void method.

4. The user can ask a Grid whether a particular cell isValid.

5. The user can ask a Grid to set a particular value by setValue to a particular row and col. The grid sets the value only if that cell is valid.

6. The user can ask a Grid to getValue (in this case integer) from a particular row and col. The grid returns the value only if the locations are valid.

7. The user can ask a Grid to set part of its row and column with particular values. Example, setCells(int rows[], int cols[], int vals[]), in this method user can specify the indexes of rows and columns that the user wants to set with some particular values (supplied in vals array). Note that, rows, cols, and vals arrays should be of same size.

8. Make another overridden method for setCells(int rows[], int cols[], int v), that will set particular rows and cols of a grid with a particular value.

Apart from these basic requirements, feel free to add more behaviors to the Grid class that you think appropriate. Please provide explanation for those behaviors as a comment in the source file.

Write a test class to test the behaviours of the Grid class and submit the test class as well.

Note: A grid is composed of many cells. So, you may want to decompose the grid into a Cell class that encapsulates all the necessary behavior of a cell in the grid

Exercise 4 [10 points]:

Introduction
This exercise asks you to implement a small class that will later serve as part of larger programs. You will implement a new kind of number, a BoundedInteger.

When we write programs to solve problems in the world, we often need to model particular kinds of values, and those values don't match up with the primitive types in our program language. For example, if we were writing a program to implement a clock or a calendar, then we would need numbers to represent minutes or days. But these numbers aren't Java integers, which range from -231to 231-1; they range from 0 to 59 and 1 to 31 (or less!), respectively. Java's base types are useful building blocks, but at the level of atoms, not molecules.

Tasks
Write a class for representing bounded integers.

A bounded integer takes integer values within a given range. For example, the minutes part of a time takes values in the range [0..59]. The next minute after 59 is 0. The minute before 0 is 59.

Object creation
We want to be able to create bounded integers in two ways.

1. We specify the object's lower bound, its upper bound, and its initial value.

2. We specify only the object's lower bound and its upper bound. The object's initial value is the same as its lower bound.

Of course, this means that you need to write two constructors.

We would like to be able to use bounded integers in much the same way we use regular ints.

Arithmetic operations
We would like to be able to:

• add an int to a bounded integer.

• subtract an int from it.

• increment and decrement it.

A bounded integer "wraps around" when it does such arithmetic. For example, suppose that we have a minutes bounded integer whose value is 52. Adding 10 to this object gives it a value of 2.

Value operations
We would like to be able to:

• ask a bounded integer for its value as an int.

• change its value to an arbitrary int.

• print its value out. The way to do this in Java is for the object to respond to toString() message by returning a String that can be printed.

If we try to set a bounded integer to a value outside of its range, the object should keep its current value and print an error message to System.err. or System.out.

Comparison operations
We would like to be able to:

• ask one bounded integer if it is equal to another.

• ask one bounded integer if it is less than another.

• ask a bounded integer if a particular int is a legal value for the bounded integer. For example, 23 is a legal value for the minutes bounded integer, but 67 is not.

The answer to each of these questions is true or false.

You may implement these requirements in any order you choose, though you'll need at least one constructor before you can test any of the others. Write a class to test your code and submit that test class as well.

Some Suggestions for Coding:

To write your program, first write a test that expresses what you would like your code to do, and then write the code to do it. Take small steps, and your tests will give you feedback as soon as possible.

Exercise 5 [15 Points]

For this exercise, you will design a set of classes that work together to simulate a parking officer checking a parked car issuing a parking ticket if there is a parking violation. Here are the classes that need to collaborate:

• The ParkedCar class: This class should simulate a parked car. The car has a make, model, color, license number.

• The ParkingMeter class: This class should simulate a parking meter. The class has three parameters:

− A 5-digit ID that identifies the meter.

− A reference to the car (ParkedCar object) that is currently parked at the meter. If no car is parked, this parameter should be set to null (in this case, make sure to return “Car: none” in your toString method).

− Whether the meter has expired or not.

− The current time (you may simulate the current time).

• The ParkingTicket class: This class should simulate a parking ticket. The class should report:

− The make, model, color and license number of the illegally parked car.

− Meter ID

− The current time.

− The amount of fine, which is $25 if the meter has expired and the current time is between 9 a.m. and 5 p.m. and $10 if the meter has expired and the current time is between 5.01 p.m. and 8.59 a.m.

− The name and badge number of the police officer issuing the ticket (DO NOT store ParkingOfficer object).

• The ParkingOfficer class: This class should simulate a parking officer inspecting parked cars. The class has

− Officer’s name and badge number

− isExpired method that examines the ParkingMeter object and determines whether the meter has expired.

− A method that examines the given parking meter and returns a parking ticket (generates a ParkingTicket object) if the meter has expired. If it is not expired or no car is parked at the meter, return null value.

You may include instance variables and public interfaces in each class as you may find appropriate. Also add appropriate error checks.

Write a client program that demonstrates how these classes collaborate. In addition, you should create a UML diagram for demonstrating relationship among the classes and submit that UML as part of your submission.

Here are some examples of your output. They need not be exactly as shown. Feel free to be creative, but you should test your program for all cases.

Parking Meter: 34521 Time: 8.00 p.m.

No car parked.

Parking Meter: 45673 Time: 4.54 p.m.

Car Parked: Lexus ES350, Black, ABC123

Meter: Not expired

Parking Meter: 98764 Time: 5.01 p.m.

Car Parked: Toyota Camry, Red, EFL786

Meter: Expired

Parking Ticket Issued

Toyota Camry, Red, EFL786

Meter ID: 98764 Time: 5.01 p.m.

Fine Amount: $10

Issuing Officer: G.Bertrand, IO5674

Homework is Completed By:

Writer Writer Name Amount Client Comments & Rating
Instant Homework Helper

ONLINE

Instant Homework Helper

$36

She helped me in last minute in a very reasonable price. She is a lifesaver, I got A+ grade in my homework, I will surely hire her again for my next assignments, Thumbs Up!

Order & Get This Solution Within 3 Hours in $25/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 3 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 6 Hours in $20/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 6 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 12 Hours in $15/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 12 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

6 writers have sent their proposals to do this homework:

Quality Homework Helper
Buy Coursework Help
A+GRADE HELPER
Peter O.
Writer Writer Name Offer Chat
Quality Homework Helper

ONLINE

Quality Homework Helper

Hi dear, I am ready to do your homework in a reasonable price.

$62 Chat With Writer
Buy Coursework Help

ONLINE

Buy Coursework Help

Hi dear, I am ready to do your homework in a reasonable price.

$62 Chat With Writer
A+GRADE HELPER

ONLINE

A+GRADE HELPER

Greetings! I’m very much interested to work on this project. I have read the details properly. I am a Professional Writer with over 5 years of experience, therefore, I can easily do this job. I will also provide you with TURNITIN PLAGIARISM REPORT. You can message me to discuss the detail. Why me? My goal is to offer services to you that are profitable. I don’t want you to place an order once and that’s it. For me to be successful, I need you to come back and order again. Give me the opportunity to work on your project. I wish to build a long-term relationship with you. We can have further discussion in chat. Thanks!

$55 Chat With Writer
Peter O.

ONLINE

Peter O.

Hello, I can assist you in writing attractive and compelling content on ganja and its movement globally. I will provide with valuable, informative content that you will appreciate. The content will surely hit your target audience. I will provide you with the work that will be according to the needs of the targeted audience and Google’s requirement.

$55 Chat With Writer

Let our expert academic writers to help you in achieving a+ grades in your homework, assignment, quiz or exam.

Similar Homework Questions

Managing organizational change a multiple perspectives approach ppt - The death of the hired man summary - Disbursement float and collection float - Applied Math in Construction - Properties of quadrilaterals lesson plan - Ahimsa chapter 1 summary - How to draw orbitals - What is the formula for the permanganate ion - Electrocomp's management realizes that it forgot to include two - Bossa nova sequence dance - Sql stands for in computer - Ancient roman technology and engineering - Ghiberti isaac and his sons - REply - Anne mcarthur notre dame - Global woman barbara ehrenreich pdf - Components of fitness pdhpe - Cwv origins powerpoint - 240 wellington street collingwood - 400 Word discussion for speech and writing for business communication - Payroll accounting final project - Ordering and seriation activities for preschoolers - The men we carry in our minds analysis - Independent university bangladesh tuition fees - Improvement plan presentation - St martin de porres high school waukegan il - Essay revision - The perils of being moderately famous epub - Habit opco fall river - How the concept of health has changed overtime - Understanding Digital Identity Formation - In expanded academic asap, the publication field indicates - Chapter 5 cell structure and function answer key - Social legal and ethical issues in marketing - Blockchain - Capes corporation is a wholesaler of industrial goods - Continuous problem city of monroe - Park avenue money power & the american dream - Gloria munez freedom writers - Classical Cloud Discussion - APA assignment - 4 types of pathogens - Ny times 301 argumentative prompts - The old deluder satan law of 1647 required that - Blue sky fostering hampshire - Boston bait shop uses a periodic inventory system - The Multinational Enterprise In Global Production And Trade Networks - Individual Essay - Advantages of cultural change - Sample grant proposal for community center - Operations management - Molar heat of combustion of ethanol experiment - Easy rider cemetery scene analysis - Case study - South west rocks spearfishing - Advantages and disadvantages of two phase locking protocol - Sustainability policy in childcare - Research Paper: Enterprise Risk Management( 4-6 papers) - Le chatelier's principle lab answers - Business law and environment important questions - High school teacher salary nsw - Gresham real estate fund - Reporting skewness and kurtosis apa - F mv2 r solve for m - What is veracity in nursing ethics - Everglades food chain diagram - Greetings from bury park book - Brave new world script - Dulux texture fine cover - IOS Models - Reading writing speaking listening viewing visually representing - Discussion: Capital Budgeting and Financial Analysis - Homework 2.3 piecewise functions answers - What is haemoglobin (and what is its function) - Uts insearch pathway scholarship - Suzhou industrial park gaohe road east suzhou jiangsu china - Gender and women's studies critical terrain second edition - Hplc analysis of aspirin lab - Unified communications at boeing - I need an essay written in APA format for a psych 130 class - This week A - Hp mfp x585 driver - Thin cylinder used in labs - PAD 520 Learning Activity: Monitoring Observed Policy Outcomes - Discussion - Love vashikaran specialist In lucknOw +91!#!#!#9928097710 Top And Best Tantrik Aghori Baba - Dah sing bank share price - Mgt 420 exam 2 - HR Management & Blockchain - Breezair evaporative cooler fault codes - Themes in the outsiders - Stolen by jane harrison - Accounting Discussion questions - Ids final paper - Is sodium azide still used in airbags - Exam timetable la trobe - Which act of macbeth contains the exposition - Hesi case study rheumatoid arthritis with joint arthroplasty - NUR 3643 - Islamic environmental ethics hsc - Dnv gl business assurance india pvt ltd - Vadasz v pioneer concrete