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

Topic: How the new vision will affect Job Performance and Job Commitment - Experiment 1 observation of mitosis in a plant cell - Initiating the Project-Problem set 4 - Buff and tuff gym excel - Imoprtance of strategic IT planning 5 - Camp bow wow revenue - Voltage divider rule for 3 resistors in series - Mkt - Forest development the indian way pdf - Convergent tools and techniques marketing - Assignment - P2 6a accounting - Amelia sung vsim - Macbeth act 1 scene 7 techniques - Mysql connector java 8.0 12 jar - Cosh x in terms of e - Sarah orne jewett biography - Pid controller circuit design - Accounting formula assets liabilities equity - Callaway erc 2 driver illegal - Case Study- minimum 2 pages and Case Questions - Journal entry 28 on course - Enc3246 uf - Given the rich and diverse skills and mindset of an ethical hacker (technical, administrative, and physical measures), which characteristics do you believe to be the most important in this role? Please explain your choice. - The epic of gilgamesh study guide - Functions of marketing channels ppt - Vcaa chemistry data booklet - Pediatric Bipolar Depression - Myer estee lauder gift with purchase 2020 - MARKET STRUCTURE AND GAME THEORY - Operator constitutive mutants of the lac operon would - Presented below are three independent situations - Humanistic and existential personality theories worksheet - Innovation Management - Techniques for combining multiple anomaly detection - Week8 discussion - New topic need help - Titan mitts link between two worlds - Fundamental qualities of accounting - Normalization of deviance in organizational practices - Ethics in psychology worksheet answers - Sherlock holmes the speckled band pdf - Marriage and family \ due in 24 hours - English 102 research paper - Example of observation in early childhood - What was sweeten company’s cost of goods sold for march? - Alvin toffler perspective on the evolution of technology - Rme es and osrme es and os - How to wire up driving lights diagram - A random sample of 337 college students was asked - What is the reading v of the voltmeter - Sweet leaf bath co case analysis - Writing solid code 20th anniversary 2nd edition pdf - Current news article - Superconducting magnetic energy storage applications - Urbancode deploy rest api - Life Cycle Assessment - Male caprine animal crossword - Jeremy kyle show foxy bingo - Human observation project - 5505 san diego edinburg tx 78542 - Nursing Leadership and Management Discussion Board - Gordon diagnostic system - Gsma sas certification list - Angry white men org - Straight line amortization of bond premium - A company using the accrual method of accounting performed - Essay On Decoding The Adult World In The Films - Ballroom dancing brisbane southside - +91-8306951337 get your love back by vashikaran IN Gulbarga - Pros and cons of being a union steward - Chapter 1 outline for Ethical Hacking Research Topic - Rsh hong kong limited - Quiz 4 - Coulomb's law conceptual worksheet - Quantum mechanical model of atom - How to apologize to a teacher for missing class - A package of mass m is released from rest - Isaac physics pre university answers - Windshield wiper linkage mechanism - 155.2 lbs to kg - Anz eftpos network attach in progress - Microeconomic theory of fertility - Economics for healthcare managers homework answers - Fingertec ta300 software download - Need help making a chart - Kanashimi wo yasashisa ni osu - Blair atholl caravan park - What ended greece's golden age making it vulnerable to invaders - The futile pursuit of happiness - Metrology and quality control - Ch 8 mini sim on new product development - Fitt principle ppt - Winding temperature indicator working principle - Beginning film studies pdf - I need a discussion - Role of President - Student centre notre dame - Advantages and disadvantages of data warehouse ppt - Algorithm