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

Address for columbia southern university - Human services in the criminal justice system trends evaluation - 600-900 APA style paper Healthcare management - Nursing: Evidence-Based Practice - Pres a ply labels 30400 template - Three grams of musk oil are required for each - Production of ethanol from waste paper - True and false - To assess the influence of self esteem on interpersonal attraction - Did ned kellys mum sell him - How to calculate hire purchase interest with effective rate - Keg king mill motor - Ultimate wood heaters hobart - How have electronic media and their convergence transformed journalism - Obtain the thevenin equivalent at terminals ab - Ellen ochoa contributions to society - Deloitte tracking and trading exam answers - AstroloGy bAbA 7340613399 OnLinE reaL VashIKaraN sPecIaLIsT IN bihar Sharif - Glo bus quiz 1 - H101 - Who wrote educating rita - Yellow and red card codes - Similarities between egypt and philippines culture - Mcgraw hill action potential - Safeassign matching percentage meaning - Pre-Calculus homework. ONLINE - Cats protection chelwood gate - Side effects of msg intolerance - Cisco product quick reference guide - Gcu individual success plan - Amplifier stability k factor - Data migration cutover plan - E accent grave code - Introduction to africana literature - Homework 3 - Is crazy domains down - Fabletics hold manual review group 1 - Heart of a soul surfer the bethany hamilton story 2007 - FOUNDATION OF PUBLIC HEALTH NURSING - Introduction to java programming 11th edition liang - What three groups use ratio analysis - Reply 1 and Reply 2 ,150 words each one,citations and references by 08/27/2020 at 8:00 pm,please add references and citations - The dreamer of oz cast - Hope by lisel mueller - The rabbit and the turtle - Chemdraw molecular orbital diagram - HomeWork and Project - Shortness of breath soap note - A loaf of bread james alan mcpherson summary - Only about children mcdowall - Respect for acting author hagen - Land rover case study harvard pdf - Mark berry royal holloway - 9781943153435 - Order 2207845: Advanced Directives informed consent - Tia/eia 568 c vs 568b - Charter club opulence 800 thread count review - Penn foster writing skills part 2 answers - Bridge to terabithia essay - Community living and respite - Managerial accounting 14th edition solutions chapter 2 - Canadian club 42 lcbo - Bs1361 short circuit capacity - Harlem children's zone case study analysis - Red lion display 4-20ma - University college dublin english courses - Wickes corner bath panel - Elements of reward management - Labor Relations and Collective Bargaining - Elevation of privilege eop threat modeling card game - Christine ewing is a licensed cpa - Mateo on bachelorette - Executive Program Practical Connection Assignment - Les grands seigneurs poem - His shadow shouts on a nightmare scream meaning - Swot analysis of ferrero rocher - Early christian architecture comparative analysis - Bygone japanese camera brand that merged with konica - Unit 10 circles homework 8 equations of circles answer key - Dartmouth high school nova scotia - Assignment - Article Analysis - Discussion Posts Due today - Balanced chemical equation for khp and naoh - 7 p's of service marketing mix with examples ppt - Pcli lasik cost - Skill based assessment packet tracer - Tompkins and cheney's organizational control theory - Cost accounting chapter 3 solutions - HR_STR (U3) - What does the dagger symbolise in macbeth - Deepview swiss pdb viewer - Normal probability plot excel 2007 - Types of informational text - Dayton vineyard church - Fundamentals of small group communication - How to create a genogram in word - Victoria bc climate zone - Is xeo3 polar or nonpolar - Three long straight wires are carrying currents