Hello, I am just starting computer science 2 at my college, and we are required to submit a "qualification" program to be able to enter the class, however, from reading to program requirements, i can see it requires a higher skill in programming than we were taught in CS1. We barely touched on OOP in CS1 and it seems this program will require programming in this area. Can someone please point me in the right direction.
I am to write a program that will organize orders for a distribution center
Each delivery slip should contain the address of the source, address of the destination and a description of the package
The program should provide the following options.
1. Add a new delivery slip, including entering the necessary delivery information (item, source, and destination) and place it into the list at any position.
2. Move a delivery slip to a new position in the list.
3. Delete a delivery slip.
4. View the list of slips.
5. generate a list in a text document
6. Allow a maximum of 100 delivery slips in the list.
I'm assuming that i will be needing to write a class for this. I really am not sure how to attack this problem. Any tips would be awesome. I was thinking of maybe writing a switch for the menu, and writing individual functions to perform each task(add, move, delete, view, and print to txt file.) that would be called in the switch. Can i get away with just using string arrays for this? Or would classes be the more efficient route?
If I was in your position I would create a "delivery slip" class, making item, source and destination members of the class, all of the operations 2.-5. members of the class.
Script Coder did recommended a linked list which is a good idea but in my opinion an array of "delivery slips" will be enough especially as the maximum capacity is 100 and it's a lot simpler.
@Ink2019 If you read the origional post, he has to be able to:
Add a new delivery slip, including entering the necessary delivery information (item, source, and destination) and place it into the list at any position.
Move a delivery slip to a new position in the list
note the need to insert t any point, thus a linked list.
Can the delivery slip be returned as a .txt file? If so, find a good tutorial on the ifstream header. Mine might look like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include <iostream>
#include <fstream>
//this one will use only number values, otherwise #include <string.h>
usingnamespace std;
int main()
{
int a,b;
cout<<"Input first number to be stored: ";//this is the tracking number
cin>>a;
cout<<"Input number 2: ";//This is the number amount of part X
cin>>b;
ifstream delivery_slip ("SLIP.txt");/*I'm sure this syntax is wrong for new compilers*/
cout<<"Tracking Number: "<<a;
cout<<"Number of parts to be shipped: "<<b;
return 0;
}