Concept explainers
Create a C
The program has four commands:
a] Origin - enables Robot to return to the point of origin which is 0,0
b] Location - prints the current location of Robot
c] Move - Robot moves to the following directions: 6-East, 4-West, 8-North, 2-South. Distance should be given (an integer).
d] Exit - prints "Program terminated. Thank you!"
The program includes the following functions:
char printCommand(void)- displays the menu of commands and accepts and returns the choice.
void initialize(int *x,int *y); - initializes the two points back to the point of origin, 0,0.
void printLocation(int x,int y) - prints the current location of Robot.
void move(int *x, int *y); - reads and displays the direction and the distance, computes the current location of Robot.
void exit(void); - prints a message of termination.
main()- uses the switch structure for the choices. Note that in a Cartesian plane, it is composed of points with x and y coordinates.
Filenames: robot.h, robot.c, main.c
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 3 images
- Assignment #2 Instructions: Through this programming assignment, the students will learn to do the following: Learn to work with command line options and arguments Gain more experience with Makefiles Gain more experience with Unix Learn to use some of the available math funtions available with C Usage: mortgagepmt [-s] -r rate [-d downpayment] price In this assignment, you are asked to perform the mortgage payment calculation. All information needed for this will be passed to the program on the command line. There will be no user input during the execution of the program You will need a few pieces of information. The price of the home and the amount of the down payment. You will also need to know the interest rate and the term of the mortgage. To figure your mortgage payment, start by converting your annual interest rate to a monthly interest rate by dividing by 12. Next, add 1 to the monthly rate. Third, multiply the number of years in the term of the mortgage by 12 to calculate…arrow_forwardC# languagearrow_forwardWeek runners log Coding in Python and mainly using loops create a program base on the following; Mike, Tina, Jason, Vicky, and Tammy are preparing for an upcoming marathon. Each day of the week, they run a certain number of miles and write them into a notebook. At the end of the week, they would like to know the number of miles run each day, the total miles for the week, and average miles run each day, Write a program to help them analyze their data. Your program should create a two-dimensional list of five rows and seven columns to store the number of miles run by each runner each day. Sample Output Name Day 1 Day 2 Day 3 Day 4 Day 5 Day 6 Day 7 Average =============================================Mike 10.00 15.00 20.00 25.00 18.00 20.00 26.00 19.14Tina 15.00 18.00 29.00 16.00 26.00 20.00 23.00 21.00Jason 20.00 26.00 18.00 29.00 10.00 12.00 20.00 19.29Vicky 17.00 20.00 15.00 26.00 18.00…arrow_forward
- Problem Statement The barcode used by the U.S. Postal System to route mail is defined as follows: Each decimal digit in the ZIP code is encoded using a sequence of three half-height and two full-height bars. The barcode starts and ends with a full-height bar (the guard rail) and includes a checksum digit (after the five-digit ZIP code or ZIP + 4), computed by summing up the original digits modulo 10. Define the following functions: Draw a half-height or full-height bar on stddraw. Given a digit, draw its sequence of bars. Compute the checksum digit. Also define global code that read in a five- (or nine-) digit ZIP code as the command-line argument and draws the corresponding postal barcode.arrow_forwardAssignment #2 Instructions: Through this programming assignment, the students will learn to do the following: Learn to work with command line options and arguments Gain more experience with Makefiles Gain more experience with Unix Learn to use some of the available math functions available with C Usage: mortgagepmt [-s] -r rate [-d downpayment] price In this assignment, you are asked to perform a mortgage payment calculation. All information needed for this will be passed to the program on the command line. There will be no user input during the execution of the program You will need a few pieces of information. The price of the home and the amount of the down payment. You will also need to know the interest rate and the term of the mortgage. To figure your mortgage payment, start by converting your annual interest rate to a monthly interest rate by dividing by 12. Next, add 1 to the monthly rate. Third, multiply the number of years in the term of the mortgage by 12 to calculate the…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education