Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1310 2019 A04 Conveyor Due Feb 12 by 11:59pm Points 40 Submiting a file upload Descrption: In this assignment you'll extend the Java language by

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
1310 2019 A04 Conveyor Due Feb 12 by 11:59pm Points 40 Submiting a file upload Descrption: In this assignment you'll extend the Java language by creating your own type:Conveyor You do that by implementing the class Conveyor based on the UML class diagram provided. You'll also write bus a corresponding test client that accesses and tests the constructor and methods of class Conveyor ules As always make sure to follow best practices like proper indentation, following Java naming conventions providing prompts before reading in information from the user, adding appropriate comments, using single empty lines to structure your code, etc. Media ccess ine Tutoring type: String + getType 0:String + setSpeed ( speed : double) Instructions: e here to search 8881310 Create a project called Conveyor It includes two java files: Conveyor java and ConveyorApp.java ConveyorApp is the test client and includes the main method. Conveyor.java Create a public class called Conveyor based on UML class diagram above Include the following three comments to help you structure the code. // fields // constructors // methods In this step attention to details is very important Make sure to match the names, types, parameter lists, access modifiers, etc. exactly as specified. No class members should be added or removed. The speed is measured in m/s (meters per second) For clarity please include an inline comment next to the field declaration The getters should have the typical default implementation. . The constructor and setter require some input validation. Negative speed should not be allowed. Whenever the user provides a negative speed value it should be ignored and the speed should remain unchanged. In case of the constructor the field would remain default initialized (speed: o) Hint: avoid code duplication. The method timeToTransport requires some calculation. Based on the current speed t should return the time it takes to transport an item for the specified distance. The distance is provided in meters and the time should be returned in seconds. ConveyorApp.java 2.6 Log https://slocirst ConveyorApp.java Class ConveyorApp is a test client and includes the main method. It calls the constructor and methods of class Conveyor in order to test that it works as expected In main do the following Create two conveyors: a flat belt conveyor and a roller conveyor Both are instances of Conveyor For the first conveyor the type is flot belt and its speed is 0.9 m/s. For the second conveyor the type is roller and its speed is -0.5 m/s. Notice that we used an invalid negative speed. We do this in order to test the input validation. For both conveyors print the following conveyor information: the type of the conveyor the current speed how long it takes to transport an item 50 m If the input validation works as expected the negative speed never got assigned to the field and the speed of the second conveyor defaulted to 0. Without any movement of the conveyor it takes forever to transport an item. Important; obtain the required values from the Conveyor instances (by calling methods from class Conveyor) . At this point we tested the constructors, the getters, and the method timeToTransport. However, we haven't tested the setter yet. In order to test the setter do the following: e Change the speed of the first conveyor to -3 The input validation should notice that the value is not valid and thus leave the speed unchanged (stil 0.9) Change the speed of the second conveyor to 0.4 0.4 is a valid speed and the field should be updated accordingly . ype here to search 8881310 . At this point we tested the constructors, the getters, and the method timeToTransport. However, we haven't tested the setter yet. In order to test the setter do the following: Change the speed of the first conveyor to -3 The input validation should notice that the value is not valid and thus leave the speed unchanged (stll 0.9) . Change the speed of the second conveyor to 0.4 0.4 is a valid speed and the field should be updated accordingly. . Again print the conveyor information we printed before but this time it reflects the latest updates . Make the output look exactly like the expected output shown below. Notice that it includes labels, units, etc. Notice also that the time displays only one digit after the decimal point. Create a video recording that shows shows the code of class Conveyor and ConveyorApp. Please start at the very top of the file and slowly scroll down so that I can stop in order to have a closer look at the code. After showing the code compile and run the program. Change the size of the output window so that all of the output can be seen. The length of the video should be about 1 minute. Expected Output: Conveyor1: flat belt conveyor with a speed of 0.9 m/s Time to transport an item 50 m: 55.6s Conveyor2: roller conveyor with a speed of 0.0 m/s Time to transport an item 50 m: Infinity s e https://slocinst rses/533583/assig 8881310 Expected Output Conveyor1: flat belt conveyor with a speed of 0.9 m/s Time to transport an item 50 m: 55.6 s Conveyor2: roller conveyor with a speed of 0.0 m/s Time to transport an item 50 m: Infinity s . updating speed Conveyor!: flat belt conveyor with a speed of .9 m/s Time to transport an item 50 m: 55.6 s Conveyor2: roller conveyor with a speed of e.4 a/s Time to transport an item 50 m: 125.0 s Submission: Submit both the video recording and a zip file that includes the java files A04 Conveyor Criteria Ratings Pts Set up project as specificd Create a project called Conveyor that includes 2 filcs: Conveyor java and ConveyorApp.java ConveyorApp nceds to include the main method. 1.0 pts Follow best practices

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts Of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

4th Edition

0619064625, 978-0619064624

More Books

Students also viewed these Databases questions