Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need the code for this assignment. My code ive tried 3 times wont output. :/ The objectives of this assignment are to: Gain a

I need the code for this assignment. My code ive tried 3 times wont output. :/ image text in transcribed
image text in transcribed
The objectives of this assignment are to: Gain a further understanding and experience in the use of the Eclipse IDE for Java. Gain a further understanding of the basic definition and use of objects including class definition, constructors, instance variables, and methods. Gain a further understanding of developing a program to test the Java classes Create a class Robot. The robot moves around in a Cartesian coordinate system and can only move in only one direction (either x or y, but not both) at a time. A robot has a name, position, y position, and total distance traveled. Implement the following constructor and methods: Robot(String name) constructor that sets the name attribute and initializes the remaining attributes to locate the robot at coordinate (0,0) getName() getter, returns a String containing the robot name getXPosition getter, returns the current x position of the robot getYPosition getter, returns the current y position of the robor moveX(int distance) moveY(int distance) adjusts the x position by distance and adds the distance to the total distance traveled adjusts the y position by distance and adds the distance to the total distance traveled returns the total distance traveled by the robot distance Traveledo) Develop an application named Prog3 that tests your Robot class The test application will ask the user for the robot's name. It will then instantiate a Robot object using the name. The application will then use a loop to ask the user to enter direction (x or y) to move and the distance. The loop will terminate when the user enters a direction of q (for quit). Once the loop is done, the program will display the robot's final position and the total distance it traveled. A typical output of the program including user interaction is provided below: Robot name: R2D2 Direction of move (x/y/q): x Distance: 100 Direction of move (x/y/g): Y Distance: 50 Direction of move (x/yq): X Distance: -20 Direction of move (x/a): R2D2 is now at position (80.50 and traveled a total of 170 5:18 moodle.up.edu moveX(int distance) adjusts the x position by distance and adds the distance to the total distance traveled move(int distance) adjusts the y position by distance and adds the distance to the total distance traveled distance Traveledo returns the total distance traveled by the robot Develop an application named Prog3 that tests your Robot class The test application will ask the user for the robot's name. It will then instantiate a Robot object using the name. The application will then use a loop to ask the user to enter direction (x ory) to move and the distance. The loop will terminate when the user enters a direction of q (for quit). Once the loop is done, the program will display the robot's final position and the total distance it traveled. A typical output of the program including user interaction is provided below: Robot name: R2D2 Direction of move (xyla (: Distance: 100 Direction of move (x/yq) y Distance: 50 Direction of move (x) Distance: -20 Direction of move (x/y4): R2D2 is now at position ( 80.50 ) and traveled a total of 170 units ) Requirements Your source code should abide by the Java programming standards for the course - Your source code should be documented using Javadoc style according to the course standards. Use the default package in your project, do not specify a package in your code Use any file and class names specified in the assignment Preparation for submission: After you have completed the program, put all of the java the files (Prog3.java and Robot.java) into a zip file named YerurlastName3.zip. The zip file should have no subdirectory structure. Deliverables: Submit your single zip file via Moodle containing only the java file. There must be no directory structure to interfere with testing

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

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 1 Lncs 13426

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124227, 978-3031124228

More Books

Students also viewed these Databases questions

Question

The models used to analyse different national cultures.

Answered: 1 week ago

Question

Simplify: 1+tan 2 A / 1+cot 2 A.

Answered: 1 week ago