Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question: The Automatic Identification System (AIS) is a tracking system that uses transceivers on ships and is used to monitor shipping traffic. Live information can

Question:

The Automatic Identification System (AIS) is a tracking system that uses transceivers on ships and is used to monitor shipping traffic. Live information can be rendered (see e.g. www.marinetraffic.com) and and historic information can also be recovered. In this exercise, you will create a C program with different functions to manage a database holding vessel information, similar to the AIS. The information that will be reported in your program is: the ship name ( string), its Maritime Mobile Service Identity (MMSI) ( unsigned long), the vessel type (enum), the year built ( unsigned short), the tonnage ( unsigned short), and the flag (string). For the vessel type, please use the following definition of the vessel type: enum vessel_type = Container = 0, Passenger = 1, Fishing, Cargo = 2, Tanker = 3; Please print the equivalent ID for the enum to the screen. You will create 1) a function that allows the user to enter the 6 fields for a new vessel; 2) a function to return the number of vessels in the database; and 3) a function to print the complete database for all the ships, where each entry is printed on a new line; and 4) a function to delete the last boat entered. In your main function, a main menu is displayed, and the user is asked whether he/she wants to (N) enter a new field; (V) print the number of vessels; (C) print the complete database, (D) delete the last boat entered. For the purpose of the demonstration, your database should hold a maximum of 10 entries. To handle the database, use arrays.

Main function for this question given

#include

#define NAME_SIZE 12

clear(void) { while (getchar() != ' '); }

int main(void) {

char c; char first_name[NAME_SIZE];

printf("Hi, please enter your first name followed by an enter ");

scanf_s("%s", first_name, NAME_SIZE);

printf("Thank you, %s. Now we will create a program to manage an AIS database ", first_name);

clear();

while (1) { printf("Menu: (N)enter a new field; "); printf("(V) print the number of vessels; "); printf("(C) print the complete database, "); printf("(D) delete the last boat entered. ");

c = getchar(); switch (c) { case 'N': // new field printf("You have requested to enter a new vessel entry ");

// function call (TO DO) break; case 'V': // print the number of vessels printf("You have requested to print the number of vessels ");

// function call (TO DO) break; case 'C': // print the complete database (one entry on each line) printf("You have requested to print the complete database ");

// ... break; case 'D': // delete the last boat entered. printf("You have requested to delete the last boat entered ");

// ... break; default: break; } clear(); } }

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

Recommended Textbook for

Practical Issues In Database Management A Refernce For The Thinking Practitioner

Authors: Fabian Pascal

1st Edition

0201485559, 978-0201485554

More Books

Students also viewed these Databases questions

Question

What are the different types of networks?

Answered: 1 week ago