Posted by Keisha on Saturday, July 3, 2010 at 11:57am.
Can anyone please write a basic c++ code for the following instructions?
Congratulations! You’ve been hired by the Fly-By-Night-Engineering-Company, Your new supervisor asks you to write a C++ program that will manage a list of robotic sensors, stored in an array of structs. This program will give you practice inputting data from files, writing and calling functions, using arrays and outputting data to a file. You should only use one array of structs.
The infotype in this problem will consist of a robotic sensor name (string), an ID number (string), an energy level (int), and a counter(int). New entries are added to the end of the array. Whenever an item is accessed by the FIND or MODIFY command, its counter is incremented by one.
Prompt the user to input the name of the data file. (5 pts) The input contains lines of the following format:
<command> < data for processing the command>
commands are: INSERT, MODIFY, REMOVE, FIND, PRINT, EXIT
//----------------------------------------------------------------------------------------------------------------
INSERT will be followed by a name, ID number, and energy level.
(10 pts) Insert a new entry with the name, ID number, energy level, and zero counter to the end of the array
//----------------------------------------------------------------------------------------------------------------
MODIFY will be followed by a robotic sensor name and a new ID number
( 10 pts) Changes the ID number for the indicated name. Increment the counter.
//----------------------------------------------------------------------------------------------------------------
REMOVE will be followed by the name of the robotic sensor to delete from the array
(10 pts) removes the entry with the indicated name from the array
//----------------------------------------------------------------------------------------------------------------
FIND will be followed by the ID number to find in the list
(10 pts) print out the indicated name for the specified ID number. Increment the counter.
//----------------------------------------------------------------------------------------------------------------
PRINT (print) will have no additional data
(5 pts) Print the contents of the array; print name, ID number, energy level, and counter for each entry
//----------------------------------------------------------------------------------------------------------------
EXIT (exit) will have no additional data.
(10 pts) stop processing; do the following prints to the screen:
Use Selection sort to sort the array in order by name.
Print the entire list.
Print the list entries with a zero counter. (these were not Found or Modified)
Print the list entry with the largest counter. (this was the most accessed/altered user data)
In addition print the entire list to an output file.
Name the output file with your first and last name.
Notes:
1. Print a message if the name being searched for is not in the array.
2. Do not use global variables; pass parameters.
3. You should use functions to accomplish each task. You must have at least five functions.
4. Make sure that your output has a heading and is labeled.
Tips
You cannot just read the file and put each line into the array. You need to read the command on the line and then decide what needs to happen.
- Computer Science - SraJMcGin, Saturday, July 3, 2010 at 2:20pm
No, I definitely can NOT! But here are some links to tutorials which may help:
http://search.yahoo.com/search?fr=mcafee&p=how+to+write+a+basic+c%2B%2B+code+tutorial
Sra
- Computer Science - MathMate, Saturday, July 3, 2010 at 8:19pm
This is definitely not a "basic" C++ program, since you will need to use struct, functions, string manipulations and input/output.
I find it curious that C++ is based on objects and classes, while C requires the use of structs to organize data. Why would one use structs in C++?
If you would start the project with pseudocodes, or actual coding, and post the difficulties you encounter, someone would be glad to help you overcome them.
Answer this Question
Related Questions
Business Management - You have recently been hired as a new manager hired into a...
Scenario Question? - Dan is an employee at a regional mid-size computer company ...
business - You have recently been hired as a new manager hired into a failing ...
biomedical engineering - my major for college is biomedical engineering and i ...
math - R. C. Droid has developed a new computer. He calls it the Droid computer...
Accounting - Write a 200- to 300-word response to the following: You have been ...
business - You have recently been hired as a new manager hired into a failing ...
bus - You have recently been hired as a new manager hired into a failing ...
Programming (Visual Basic) - Im seem to be having trouble with this Exercise. ...
Math - a phone company wants to create some new area codes. Each new area code ...
For Further Reading