, ,

[SOLVED] Cse 1325-001 homework 1 to 7 solutions

$25

File Name: Cse_1325_001_homework_1_to_7_solutions.zip
File Size: 357.96 KB

5/5 - (1 vote)

For this homework assignment, you will be writing a “Hello World” Program, but with some
extra lines of output, asking for user input, and performing arithmetic operations on ints and
doubles.

First, you must set up your Ubuntu environment (see class slides).
Second, you must write a program, called “abc1234_Hello_World_1.cpp” (replace abc1234 with
your netid) that does the following:
• Say “Hello User” to the user when the program is created
• Ask the user for their name
• Take their name as input
• Thank the user by name for telling you their name
• Ask for two numbers (ints)
• Show the Sum of these two numbers as an int
• Show the Difference of these two numbers as an int (Num1 – Num 2)
• Show the Product of these two numbers as an int
• Show the Quotient of these two numbers as an int (Num 1 / Num 2)
• Ask for two more numbers (doubles)
• Show the Sum of these two numbers as a double
• Show the Difference of these two numbers as a double (Num1 – Num 2)
• Show the Product of these two numbers as a double
• Show the Quotient of these two numbers as a double (Num 1 / Num 2)
• Thank the user “by name” for their time

Create a second file called “abc1234_Hello_World_2.cpp”. This will do the exact same thing as
above, but with one main difference. You will not ask for the user’s name. Instead, you must
figure out the user’s name by some other means. It is acceptable to be a user name, proper
name, or some other identifying name for that person. The name cannot be hard-coded in the
source file. Test your program in two different user accounts (create a 2nd account on your
Ubuntu copy with different profile information) and see if it works.

You will submit your code and screen shots of your code working via Blackboard. You will
upload a ZIP file, named “abc1234_HW1.zip”, containing 2 files (5 if you did bonus):
• abc1234_Hello_World_1.cpp (source code)
• abc1234_Hello_World_1.png (screen shot of program running)
• abc1234_Hello_World_2.cpp (source code)
• abc1234_Hello_World_2a.png (screen shot of program running with first user)
• abc1234_Hello_World_2b.png (screen shot of program running with second user)
• When you submit your file, leave the GTA instructions on how to compile your code and
run it. Note: he will be using terminal on the virtual machine that I used in class.
Instructions can be included as a comment on blackboard or in a README.txt file.
Full credit files named incorrectly result in a loss of 5 points each. Bonus files named incorrectly
will result in a loss of 1 bonus point each.
For information on taking screen shots and creating zip files in Ubuntu, see the class resources
section in Blackboard.

For this homework assignment, you will be given a text document with a secret code. The text
document contains a series of lowercase words, each on a separate line. Some worlds will have
letters replaced with uppercase letters or numbers. The secret code is all the capital letters put
together and the sum of the numbers.

 Open the file Words.txt to be read
 Store each word in a vector
 Output the list of words to the terminal
 Go through the vector checking each character of each string
 If an uppercase letter, add it to the word
 If a number, add it to a sum of all numbers
 Output the secret code to terminal
 Save the secret code to a file called abc1234_Secret_Code_1.txt
 Append the secret code to the end of the text document that came with the homework

The bonus for this homework will work the same as the full credit but with two exceptions. The
first is that you will use the file Bonus_Words.txt. The second that if you see two numbers next
to each other, that is a two digit number, not 2 separate numbers.

You will submit your code and screen shots of your code working via Blackboard. You will
upload a ZIP file, named “abc1234_HW1.zip”, containing 2 files (5 if you did bonus):
 abc1234_Secret_Code_1.cpp (source code)
 Words.txt
 abc1234_Secret_Code_1.png (screen shot of program running)
 abc1234_Secret_Code_1.txt
 abc1234_Secret_Code_2.cpp (source code)
 Bonus_Words.txt
 abc1234_Secret_Code_2.png (screen shot of program running)
 abc1234_Secret_Code_2.txt
 When you submit your file, leave the GTA instructions on how to compile your code and
run it. Note: he will be using terminal on the virtual machine that I used in class.
Instructions can be included as a comment on blackboard or in a README.txt file.
Full credit files named incorrectly result in a loss of 5 points each. Bonus files named incorrectly
will result in a loss of 1 bonus point each.

In this homework, you will create a class that stores a list of transactions and computes the average transaction for a given month. The user must input the name of the month and the transactions into the terminal. The Transaction_List Class First you will create two C++ files called abc1234_Transaction_List.h and abc1234_Transaction_List.cpp. Below is a UML class diagram that shows the basic design of the Transaction_List class.

This class contains a list of transactions for a certain month. Each transaction is represented a double in the vector transactions. The constructor sets the month equal to the m and the num_transactions to 0. get_name returns the name of the month. add_transaction adds a new transaction to the list of transactions and 1 to num_transactions. average_transaction returns the average transaction for that month. If there are no transactions, then this should return 0. Testing the Transaction_List Next you will test your Transaction_List class by creating a new C++ file called abc1234_test.cpp, which consists of just a main method.

The main function must be able to do the following three tests.  Test #1 o Create a Transaction_List object named “May” and add 4 transactions: 150, 225.3, 78.9, and 523.99 o Get the Transaction_List’s name. If the month is not “May”, display a useful error message to the terminal (cout). o Compute the average transaction for the month. If the average is not 244.5475, display a useful error message to the terminal (cout).  Test #2 o Create another Transaction_List called “March” and add 4 transactions: 150, 225.3, 78.9, and 523.99 o Get the Transaction_List’s name. If the month is not “May”, display a useful error message to the terminal (cout). o Compute the average transaction for the month. If the average is not 244.5475, display a useful error message to the terminal (cout).  Test #3 o Create a Transaction_List object named “May” and add 4 transactions: 150, 225.8, 78.9, and 523.99 o Get the Transaction_List’s name. If the month is not “May”, display a useful error message to the terminal (cout). o Compute the average transaction for the month. If the average is not 244.5475, display a useful error message to the terminal (cout).

Take a screenshot of your terminal that shows the output from all 3 tests. Name this screenshot abc1234_test.png. If you have multiple screenshots, name them abc1234_test_1.png, abc1234_test_2.png, etc. The main program Third, write one more C++ file called abc1234_main.cpp. This main program consists of a main function that should do the following: (you may have to write more loops then what is listed below, or more functions then just main)  Create a list (vector) of Transaction_Lists  Prompt the user for the name of a month and take it in as input.  Create a Transaction_List object with the name you just received as input.  Create a loop that askes for a transaction and takes it in as input. o If the input is -999, exit the loop. o If the input is not -999, add it to the list of transactions.  When the loop is terminated, add this month to the list of Transaction_Lists.  Ask the user if there is another month he/she want to put in (Y/N) o If yes, go back to the second bullet point. o If no, print out the name of each Transaction_List (the month name) and the average, each on a different line.. Take a screenshot of your code running in terminal. Name this screenshot abc1234_main.png. If you have multiple screenshots, name them abc1234_main_1.png, abc1234_main_2.png. etc. When grading this, you do not know how many months the GTA will put in, so make sure your code can handle different number of months. Makefile You are REQUIRED to provide a simple makefile that can build and execute your test code given the command “make test”, and build and execute your main given the command “make”. The sample course code from lecture 5 is a good example of a makefile to use for the homework. You will put all relevant files for the full credit portion of the homework in a folder called full_credit.

Copy your abc1234_Transaction_List.h, abc1234_Transaction_List.cpp, and your abc1234_main.cpp into a separate folder called bonus_1. Change your Transaction_List Class so the double num_transactions is not mentioned in your code (delete all references to it). Find some way to still compute the average over the number of transactions submitted.

Once that is complete, make a new makefile for this bonus. Run your main function take screen shots of your code, using the same naming conventions as mention above. Place those screen shots in the bonus_1 folder. Bonus 2 (15 pts) For this, you will be modifying the provided UML diagram in Umbrello. The provided UML class diagram is called Transaction_List.xmi.

You are to do the following the UML diagram (double clicking the class diagram opens the properties window):  Include a private vector called person. This list will correspond to the list of transactions and will represent who rang up each transaction.  Modify the add_transaction() function to take in two arguments, one called high, one called p. The add day function will now add the input to the list of highs and name of the p into the list of person.  Next, add a method called bonus. This function will return the name of the person who rang up the most transactions in that month. Since that person rang up the most transactions, that person will bet a bonus. You will save this UML diagram to a new folder called bonus_2. Copy your abc1234_Transaction_List.h, abc1234_Transaction_List.cpp, and abc1234_main.cpp file from your full credit directory into bonus_2. Next you will modify your Transaction_List class to reflect any changes made to the UML diagram.

Lastly, modify your abc1234_main.cpp program to allow the user to input both the transactions and the names. If the transaction is still -999, quit the loop. When done taking input, output the name of the month, the average transaction, and who got the bonus, each on a different line. Take screen shots of your code working, and place those screen shots the bonus_2 folder. Follow the same naming conventions as above for the screenshots. Deliverables You will submit your code and screenshots via Blackboard. You will upload a zip file, named “abc1234_HW3.zip”, contain 1 folder (3 if you did all the bonus)  full_credit folder o abc1234_Transaction_List.h o abc1234_Transaction_List.cpp o abc1234_test.cpp o abc1234_main.cpp o abc1234_test.png (or multiple if multiple screenshots were taken) o abc1234_main.png (or multiple if multiple screenshots were taken) o makefile o Instructions for compiling and running (either in comments via blackboard or in a README file)  bonus_1 folder o abc1234_Transaction_List.h o abc1234_Transaction_List.cpp o abc1234_main.cpp o abc1234_main.png (or multiple if multiple screenshots were taken) o makefile o Instructions for compiling and running (either in comments via blackboard or in a README file)  bonus_2 folder o abc1234_Transaction_List.xmi (the UML file) o abc1234_Transaction_List.h o abc1234_Transaction_List.cpp o abc1234_main.cpp o abc1234_main.png (or multiple if multiple screenshots were taken) o makefile o Instructions for compiling and running (either in comments via blackboard or in a README file) Full credit files named incorrectly result in a loss of 5 points each.

In this homework, you will be making a different version of your Homework #3. You will be using a map
to store Transaction objects (values) sorted by Date objects (keys). You will also be making a menu to
allow a user to select different options and input data.

You are to implement 3 classes: Date, Transaction, and Transaction List.
Date represents a date, down to the second. It has 6 private variables: year representing the year,
month representing the month, day representing day, hour representing the hour, minute representing
the minute, and second representing second. There are also 4 public functions. The constructor takes in
values for the private variables and assigns them. to_string() converts the data of the class to a string.
operator<() overloads the < operation for Date objects when doing comparisons. operator<<() overrides
the << operation for Date objects when sending the Date object to and output stream.

Transaction represents a transaction that was ran by a company. Each transaction has a price, the value
that was processed by the company, and a name, the person who processed the transaction. Each
Transaction object has 5 public functions. get_price() returns the value processed in the transaction.
get_name() returns the name of the person who processed the transaction. Transaction() is the
constructor that assigns the values of price and name. to_string() converts the data of the class to a
string. operator<<() overrides the << operation for Transaction objects when sending the Transaction
object to and output stream. CORRECTION TO UML: in the constructor, the variable names are p and n.

Transaction_List represents a list of transactions stored in a map. This map has keys of Dates and values
of Transactions. This list is able to add transactions, list all transactions, get the average transaction,
delete a transaction when given a date, and delete all transactions by a certain employee. When
deleting a transaction, a useful error message must be displayed to the user if unsuccessful. This list
should also determine who gets a bonus. Bonuses are determined differently than in Homework #3. In
this homework, it is whoever rang up the highest total value of transactions, not just the number. Also
there are to_string and an operator<< functions that function similarly to the previous two classes.

In the main cpp, you must create a menu where the user can select different options. These options
must include printing out the list of transactions, adding a new transaction, deleting a current
transaction by date, deleting all transaction by a certain employee, getting the average transaction, and
getting the name of the person who earned the bonus. Please note that menus may have a submenu or
require additional input, such as asking for the date, price, and name.

Here is an example menu:
Welcome to the Transaction List Management Solution.
Please make a selection from the following menu:
1: Print all transactions
2: Add a transaction
3: Delete a transaction(s)
4: Average transaction value
5: Bonus winner
? |
All functionally must be able to be tested by the GTA when grading.

This will be the exact same as the full credit, but will require you to get the system time for the date
when a new transaction is added instead of asking the user for a date.

You will modify the Transaction class to only have the price private variable and to have the get_name()
method removed. This will require the constructor and to_string() method to be changed as well. You
will then create a new class called Employee that has private variables name and id. This class should
have a constructor, accessor methods for these fields, as well as a to_string() and an operator<<
overload.

The map in Transcation_List will now become a multimap with three fields. The order of these fields will
be <Date, Transaction, Employee>. This will require several other methods in this class to be changed as
well.
You will also show these changes in a new UML Diagram. I have provided the base UML for this project,
which is the one pictured on the first page. Be sure to show associativity.

You will submit your code and screenshots via Blackboard. You will upload a zip file, named
“abc1234_HW4.zip”, which contains 1 folder (3 if you did all of the bonus)
• full_credit
o abc1234_Date.h and abc1234_Date.cpp
o abc1234_Transaction.h and abc1234_Transaction.cpp
o abc1234_Transaction_List.h and abc1234_Transaction_List.cpp
o abc1234_main.cpp
o makefile
o abc1234_main.png (or multiple if multiple screenshots were taken). These screenshots
will be picture of your code running in terminal.
o Instructions for compiling and running your code (either in comments in blackboard or
in a README file)
• bonus_1
o abc1234_Date.h and abc1234_Date.cpp
o abc1234_Transaction.h and abc1234_Transaction.cpp
o abc1234_Transaction_List.h and abc1234_Transaction_List.cpp
o abc1234_main.cpp
o makefile
o abc1234_main.png (or multiple if multiple screenshots were taken). These screenshots
will be picture of your code running in terminal.
o Instructions for compiling and running your code (either in comments in blackboard or
in a README file)
• bonus_2
o abc1234_HW4_Class_Diagram.xmi
o abc1234_Date.h and abc1234_Date.cpp
o abc1234_Transaction.h and abc1234_Transaction.cpp
o abc1234_Employee.h and abc1234_Employee.cpp
o abc1234_Transaction_List.h and abc1234_Transaction_List.cpp
o abc1234_main.cpp
o makefile
o abc1234_main.png (or multiple if multiple screenshots were taken). These screenshots
will be picture of your code running in terminal.
o Instructions for compiling and running your code (either in comments in blackboard or
in a README file)
Full credit files named incorrectly result in a loss of 5 points each.

In this homework assignment, you will be re-structuring your previous assignment (HW4) to fit the
Model, View, Controller (MVC) Software Pattern. Also, we will be incorporating the work we did in HW2
by incorporating files.

For this part, you will need to re-structure your HW4 to fit MVC. This will be based off the full-credit
implementation. You may use the sample solution on Blackboard as a base if you do not wish to use
your own HW4 solution. You will need to modify some the existing functions in the Model to not use
cout, but return values dependent on the function’s purpose. All output statements must be handled by
the Controller and the View classes.

You will also need to modify the UML from HW4 to fit HW5. The HW4 UML is included in the HW4
solution. This homework will introduce the concept of design, so you can build the Controller and View
classes however you see fit. Also, if you wish to change anything in the existing classes, you may do so.
Just make sure any changes you make are present in the modified UML.

For any system, being able to save and load data from a file is important. That is what you will be doing
for the Transaction Management System.

You will need to add Save and Load functionalities to your program. The save file will contain the
contents of the list of transactions. When the file is loaded, it will read in the contents, create any
necessary objects, and add them to the list. When the file is saved, it will overwrite the contents of the
save file, if the file already exists. If the file does not exist, it will create the file and save to it. The name
of the save file must be “abc1234_save_file.txt”. You may format the save file however you want.

For the Files portion of this homework, you must override the >> operation so that the contents of the
save file directly into the contents of the Transaction_List, Trasaction, and Date objects. By this, I mean
that “ist >> date;” is a valid operation, where ist is a input stream and date is a Date object.

You will submit your code and screenshots via Blackboard. You will upload a zip file, named
“abc1234_HW5zip”, which contains 1 folder (2 if you did the bonus)
 full_credit
o abc1234_Date.h and abc1234_Date.cpp
o abc1234_Transaction.h and abc1234_Transaction.cpp
o abc1234_Transaction_List.h and abc1234_Transaction_List.cpp
o abc1234_View.h and abc1234_View.cpp
o abc1234_Controller.h and abc1234_Controller.cpp
o abc1234_main.cpp
o abc1234_save_file.txt
o makefile
o abc1234_main.png (or multiple if multiple screenshots were taken). These screenshots
will be picture of your code running in terminal.
o Instructions for compiling and running your code (either in comments in blackboard or
in a README file)
 bonus_1
o abc1234_Date.h and abc1234_Date.cpp
o abc1234_Transaction.h and abc1234_Transaction.cpp
o abc1234_Transaction_List.h and abc1234_Transaction_List.cpp
o abc1234_View.h and abc1234_View.cpp
o abc1234_Controller.h and abc1234_Controller.cpp
o abc1234_main.cpp
o abc1234_save_file.txt
o makefile
o abc1234_main.png (or multiple if multiple screenshots were taken). These screenshots
will be picture of your code running in terminal.
o Instructions for compiling and running your code (either in comments in blackboard or
in a README file)
Full credit files named incorrectly result in a loss of 5 points each.

In this homework assignment, you will be creating multiple classes based off the following UML diagram.

For this part, you will create a robot class. The robot has a model number, a name, a battery life (an int
representing how many “units” the battery will last for), and a position ((x,y) coordinate).

The constructor assigns all values to the input parameters, sets the position to (0,0), and sets the battery
level to max. The move method changes the coordinate location of the robot. It also reduces the battery
level by 1 unit for each distance of one it moves. The distance it moves can be calculated with the classic
distance formula. Since battery life is represented as an int, you just round up the distance traveled. This
method returns true if the move was successful and false if not, such as if the battery would die by doing
the move. charge restores the battery level to full. get_battery_percentage returns the current battery
level as a percent.

Arm_Robot is derived from Robot. Think of an Arm robot as a Sawyer Robot from Rethink Robotics. It is
a stationary robot, but the arm can move. Position and move now pertain to the end of the arm’s
position.
Three new variables are introduced. The length is how long the arm is. The weight limit is how heavy an
object the arm can pick up. is_holding is whether or not the arm is holding an object.

The constructor assigns all values to the input parameters, sets the position to (0,0), sets the battery
level to max, and sets the is_holding to false. Move acts the same as the parent class, but now each 1
distance takes an extra battery unit if it is holding an object (1 if moving, 2 if moving and holding an
object). It can also not move to a location if the desired location is past the length of the arm. Consider
the base of the arm is at (0,0). Pick_up will tell the robot to hold the object if it is under the weight limit.
Pick_up also takes 1 unit of battery. It cannot pick up an object if it already holding an object. This
method returns true if it was successful and false if not. Drop will tell the robot to drop the object. Drop
also takes 1 unit of battery. It cannot drop an object if it not holding an object. This method returns true
if the move was successful and false if not.

Extendable_Arm is derived from Arm_Robot. This robot can extend its arm further out than a regular
Arm_Robot. If it can’t reach an object, it will extend its arm further.
Two new variables are introduced. The extend_length is the distance that the arm can extend.
Therefore, the total distance the robot can reach is now the length + extend_length. is_extended is
whether or not the arm is extended.

The constructor assigns all values to the input parameters, set the position to (0,0), sets the battery level
to max, sets is_holding to false, and sets is_extended to false. Move acts the same as Arm_Robot, but
now each 1 distance takes an extra battery unit if the arm is extended (1 if moving; 2 if moving and
holding an object; 2 if moving and extended; 3 if moving, holding and object, and extended). If the
position is too far for the arm to reach, but can with the arm extended, the move() method will call
extend(). If the arm can reach the position with the arm not extended, move() will call retract. Both
extend and retract each take 1 battery unit. Extend can’t extend if already extended, and retract can’t
retract if already retracted.

Powered_Arm is derived from Arm_Robot. This robot can turn on a motor that can pick up heavier
objects than an Arm_Robot.
Two new variables are introduced. The motor_limit is how much the arm can pick up when the motor is
on. This this different than extend_length. extend_length was an additional amount to the arm length.
motor_limit is the total amount the arm can lift when the motor is on, not an additional amount. Also,
there is motor_on, which states whether or not the motor is on or not.

The constructor assigns all values to the input parameters, set the position to (0,0), sets the battery level
to max, sets is_holding to false, and sets motor_on to false. Move acts the same as Arm_Robot, but now
each 2 distance takes an extra battery unit if the motor is on (1 if moving; 2 if moving and holding an
object; 3 if moving and the motor is on; 4 if moving, holding and object, and motor is on). Pick_up() will
turn the motor on if the object is too heavy for the arm to lift on its own. Drop() will turn off the motor if
the motor is on when the object is dropped. Turning on and off the motor does not cost battery.

Mobile_Robot is derived from Robot. This robot can move around at three different speed levels.
One new variable is introduced. The speed level is how fast the robot will move. If it is a 1, it will move
slowly. If it is a 2, it will move at an average speed. If it is a 3, it will move at a fast speed.
The constructor assigns all values to the input parameters, set the position to (0,0), and sets speed level
to 1. Move with 3 parameters will set the speed level, then move the robot. Move with 2 parameters
will move the robot at whatever the current speed level is at. Slow movement is 1 battery unit for every
1 distance. Average movement is 2 battery units for every 1 distance. Fast movement is 3 battery units
for every 1 distance.

In your main function, you will create one robot of each type, each with a battery life of 100. Then the
robots will do the following (Each must print out a statement whether the robot was able to complete
the task or not. Also it must say which robot it was):
 Robot will move around until the battery drains, charge up, then move around till it drains again.
 Mobile robot will move around at three different speeds. It will also move once without not
changing the speed.
 Arm robot will move, pick up an object that it can pick up, move it, and drop it. Then the Arm
robot will attempt to pick up an object that is too heavy. Then the robot will attempt to move
beyond the length of the arm.

 Extendable_Arm will move to pick up an object that it can pick up while retracted, move it, and
drop it. Then the arm will move to pick up an object that it can only pick up while extended,
move it to a spot that it can reach only while extended, and drop it. Then the robot will to pick
up an object that it can pick up while retracted, move it to a spot it can only reach while
extended, and drop it. Next, the robot will try to reach an object it can’t reach even, while
extended.

 Powered Arm will move to pick up an object that it can pick up without the motor, move it, and
drop it. Then it will move to pick up an object that it can only pick up with the motor, move it,
and drop it. Lastly it will move and attempt to pick up an object that is too heavy.

For the Mobile Robot, change the speed_level to be an object of an Enumerator Class instead of an int.
Be sure to update the UML diagram to reflect this.

You will submit your code and screenshots via Blackboard. You will upload a zip file, named
“abc1234_HW6zip”, which contains 1 folder (2 if you did the bonus)
 full_credit
o abc1234_Robot.h and abc1234_Robot.cpp
o abc1234_Arm_Robot.h and abc1234_Arm_Robot.cpp
o abc1234_Extendable_Arm.h and abc1234_Extendable_Arm.cpp
o abc1234_Powered_Arm.h and abc1234_Powered_Arm.cpp
o abc1234_Mobile_Robot.h and abc1234_Mobile_Robot.cpp
o abc1234_main.cpp
o makefile
o abc1234_main.png (or multiple if multiple screenshots were taken). These screenshots
will be picture of your code running in terminal.
o Instructions for compiling and running your code (either in comments in blackboard or
in a README file)
 bonus_1
o abc1234_HW6_Class_Diagram.xmi
o abc1234_Robot.h and abc1234_Robot.cpp
o abc1234_Arm_Robot.h and abc1234_Arm_Robot.cpp
o abc1234_Extendable_Arm.h and abc1234_Extendable_Arm.cpp
o abc1234_Powered_Arm.h and abc1234_Powered_Arm.cpp
o abc1234_Mobile_Robot.h and abc1234_Mobile_Robot.cpp
o abc1234_main.cpp
o makefile
o abc1234_main.png (or multiple if multiple screenshots were taken). These screenshots
will be picture of your code running in terminal.
o Instructions for compiling and running your code (either in comments in blackboard or
in a README file)
Full credit files named incorrectly result in a loss of 5 points each.

In this homework assignment, you will be extending your Homework 6. You may use your existing HW6
solution, or the supplied HW6 sample solution (coming soon).
See the below UML Diagram

 Robot
o Robot is an Abstract Class, meaning there is at least one Abstract Function. An Abstract
Function is a function that is declared but not defined. In C++, an abstract function is a
pure virtual function.
o move is now a pure virtual function.
 Mobile_Robot
o Typo from HW6 has been corrected
o speed_level and set_speed_level() are now protected
 Extendable_Arm
o extended_length, is_extended, extend(), and retract() are now protected
 Powered_Arm
o motor_limit, motor_on, power_on(), power_off() are now protected4

Super_Arm inherits from Extendable_Arm and Powered_Arm. There are no variables.
The Constructor calls the base class’ constructer. Move will now take into account if it is extended and if
the motor is on. So now it will take 1 battery unit to move 1 distance, 2 if moving and holding an object,
2 if moving extended, 3 if moving, holding an object and extended, 4 if h moving, holding an object and
motor is on, 5 if moving, holding an object, motor is on, and arm is extended.

Mobile_Arm inherits from Super_Arm and Mobile_Robot. There is one new variable to help differentiate
the different between the base’s position (the mobile robot position) and the arm’s position (the end of
the arm). position is the base’s position. arm_position is the arm’s position.
The Constructor calls the base class’ constructer. There are now 5 move functions
 move(int, int) moves the base to the new coordinates at the current speed level. It just calls
Mobile_Robot’s move(int, int) method.
 move(int, int, int) move the base to the new coordinates at the new speed level. It just calls
Mobile_Robot’s move(int, int, int) method.
 move_arm(int, int) move the arm to the new coordinates. It just calls Super_Arm’s move
method.
 move(int, int, int, int) moves both the base and the arm to the new coordinates at the current
speed level. The UML shows which input variables go to which.
 move(int, int, int, int, int) moves both the base and the arm to the new coordinates at the new
speed level. The UML show which input variables go to which.

Part 5: Main with Polymorphism
You will make a second main file (abc1234_main_two.cpp). In this file, you will create a main
function that contains a list of Robots. Make sure at least one of each robot is in the list. (insert
more here)
For compiling this main, you have to use the same make file to compile from part 4. (Hint: you can
type more than just make in terminal. Think back to HW 3.)

Bonus:

Something with enumeration here.
Deliverables:

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] Cse 1325-001 homework 1 to 7 solutions[SOLVED] Cse 1325-001 homework 1 to 7 solutions
$25