Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ECS 3 6 B Winter 2 0 2 4 2 0 2 4 - 0 1 - 2 0 Homework 1 due Tue 2 0

ECS36B Winter 2024
2024-01-20
Homework 1 due Tue 2024-01-30 at 23:59
Use Gradescope to submit your work
Problem 1: Robotic arm
Description
The position of a robotic arm is determined by an angle that can only take values between -60 degrees and +120 degrees (included). In this homework, you will create a C++ class Angle that represents the angle of the robotic arm. The implementation should enforce the limits on the range of allowed values. The angle can only take integer values. Any attempt to change the angle beyond a limit should result in the angle value being that limit. For example, any attempt to change the angle to a value smaller than -60 should result in the angle value being -60.
The class Angle includes a public member function change (int dt) and a private member function set (int t). The change function uses the set function to change the angle by the amount dt. The argument dt may be positive or negative. The initial angle value at the time the robotic arm is powered up is 30 degrees. The Angle object should set its angle value to be 30 when the object is created. See the file Angle. h for details and other member functions.
The Angle class is used by a program robot. cpp that is provided. The output of the program robot must reproduce exactly the contents of the file robot. out.
The files Angle. h and robot. cpp are provided and must not be modified. You must create a file Angle. cpp containing the implementation of your Angle class. It must be possible to compile the program robot. cpp to generate an executable named robot using the command:
make
without generating any warning message. The Angle class that you provide will also be compiled and linked with another program that uses the Angle member functions when grading the assignment. You must create a Makefile that contains a target robot and a target clean. The target robot should appear first and will be used to build the executable robot. The target clean will be used to remove all object files and executables. The Makefile should include the necessary definition to compile C++ files using g++ with the - Wall option.
Submission
Create a tar file named hw1p1. tar containing the files Angle. cpp and Makefile only.
Do not compress the tar file. Include your name and Student ID in a comment at the top of each file. Submit your tar file hw1p1. tar using Gradescope.
image text in transcribed

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

Students also viewed these Databases questions