Question

In: Computer Science

Write a C program The Visual Studio project itself must make its output to the Console...

Write a C program

The Visual Studio project itself must make its output to the Console (i.e. the Command Prompt using printf) and it must exhibit the following features as a minimum:

  • 3%: Looping Menu with 3 main actions: View Cars, Sell Car, View Sales
    • Note: A Car is defined by its price and model
  • 3%: Must contain at least three arrays to record sales figures (maximum of 10 Car models)
    • Two for recording the price and model of one vehicle
    • One for recording the remaining amount of each car model
  • 3%: Viewing Cars will show a list of models and remaining amount
    • 3%: Sorted by remaining amount in descending order
  • 5%: Selling a Car needs to record the price and update existing arrays to reflect the sale data
    • 5%: Any data being accepted from the keyboard needs to be validated and filtered (i.e. only accept correct data from the user and keep asking until correct data is entered)
  • 5%: Sales figures are displayed as a total sum for each Car model
    • 5%: Sorted by total sale amount in descending order
  • 5%: Sales data is to be stored in a file
    • 7%: When the software launches, it should read previous sales data from the file, if it exists, to be used as starting data
  • 2%: Exiting the software thanks the user for using it before closing
  • 10%: Make use of topics not taught in the module, but can be applied in a relevant way to this software project (do not include features/topics just for the sake of showing that you know how to use/implement it, instead consider why it will improve the software for the user)
  • 4%: Your code needs to follow recommended coding standards and good practice
  • 5%: Also submit a Logbook containing Pseudocode (1%), Activity Diagram (1%), and Testing (3%) appropriate for your project
  • Total: 65%

Solutions

Expert Solution

#include <stdio.h>
 void main()
{
    struct date
    {
        int day;
        int month;
        int year;
    };
    struct details
    {
        char name[20];
        int price;
        int code;
        int qty;
        struct date mfg;
    };
    struct details item[50];
    int n, i, x, total=0;
    printf("1 for Sale Car ,2 for View Sales:");
    scanf("%d",&x);
    switch(x)
   {
    case 1:
    printf("Enter number of items:");
    scanf("%d", &n);
    fflush(stdin);
    for (i = 0; i < n; i++)
    {
        fflush(stdin);
        printf("Item name: \n");
        scanf("%s", item[i].name);
        fflush(stdin);
        printf("Item code: \n");
        scanf("%d", &item[i].code);
        fflush(stdin);
        printf("Quantity: \n");
        scanf("%d", &item[i].qty);
        fflush(stdin);
        printf("price: \n");
        scanf("%d",  &item[i].price);
        fflush(stdin);
        printf("Manufacturing date(dd-mm-yyyy): \n");
        scanf("%d-%d-%d", &item[i].mfg.day,
        &item[i].mfg.month, &item[i].mfg.year);
    }
    printf("             *****  INVENTORY ***** \n");
    printf("---------------------------------------------------------
    ---------\n");
    printf("S.N.|    NAME           |   CODE   |  QUANTITY |  PRICE
    | MFG.DATE \n");
    printf("---------------------------------------------------------
    ---------\n");
    for (i = 0; i < n; i++)
        printf("%d     %-15s        %-d          %-5d     %-5d
        %d/%d/%d \n", i + 1, item[i].name, item[i].code, item[i].qty,
        item[i].price, item[i].mfg.day, item[i].mfg.month,
        item[i].mfg.year);
    printf("---------------------------------------------------------
    ---------\n");

case 2:

printf("             *****  INVENTORY ***** \n");
    printf("---------------------------------------------------------
    ---------\n");
    printf("S.N.|    NAME           |   CODE   |  QUANTITY |  PRICE
    | MFG.DATE \n");
    printf("---------------------------------------------------------
    ---------\n");
    for (i = 0; i < n; i++)
        printf("%d     %-15s        %-d          %-5d     %-5d
        %d/%d/%d \n", i + 1, item[i].name, item[i].code, item[i].qty,
        item[i].price, item[i].mfg.day, item[i].mfg.month,
        item[i].mfg.year);
    printf("---------------------------------------------------------
    ---------\n");

for(i=0;i<n,i++){

total+=item[i].price;

}

printf("Total sales =%d",total);

}

return 0;

}


Related Solutions

Write a C program of car sale: The Visual Studio project itself must make its output...
Write a C program of car sale: The Visual Studio project itself must make its output to the Console (i.e. the Command Prompt using printf) and it must exhibit the following features as a minimum: 10%: Looping Menu with 2 main actions: Sell Car, View Sales Note: A Car is defined only by its price 10% Must contain at least one array containing sales figures (each entry represents the price of one vehicle) for a maximum of 10 Cars 5%:...
answer the following using C# Design and program a Visual Studio Console project in C# that...
answer the following using C# Design and program a Visual Studio Console project in C# that allows your user to enter a number. The program will examine the number to see if it is prime. If it is prime, it will print the next higher prime and the next lower primes to the console. If the number entered by the user is not prime, display a message to that effect. All code should be written by you. Do not copy/paste...
Create a Visual Studio console project (c++) containing a main() program that declares a const int...
Create a Visual Studio console project (c++) containing a main() program that declares a const int NUM_VALUES denoting the array size. Then declare an int array with NUM_VALUES entries. Using a for loop, prompt for the values that are stored in the array as follows: "Enter NUM_VALUES integers separated by blanks:" , where NUM_VALUES is replaced with the array size. Then use another for loop to print the array entries in reverse order separated by blanks on a single line...
Make a Program in Visual Studio / Console App (.NET Framework) # language Visual Basic You...
Make a Program in Visual Studio / Console App (.NET Framework) # language Visual Basic You will be simulating an ATM machine as much as possible Pretend you have an initial deposit of 1000.00. You will Prompt the user with a Main menu: Enter 1 to deposit Enter 2 to Withdraw Enter 3 to Print Balance Enter 4 to quit When the user enters 1 in the main menu, your program will prompt the user to enter the deposit amount....
ONLY USE VISUAL STUDIO (NO JAVA CODING) VISUAL STUDIO -> C# -> CONSOLE APPLICATION In this...
ONLY USE VISUAL STUDIO (NO JAVA CODING) VISUAL STUDIO -> C# -> CONSOLE APPLICATION In this part of the assignment, you are required to create a C# Console Application project. The project name should be A3<FirstName><LastName>P2. For example, a student with first name John and Last name Smith would name the project A1JohnSmithP2. Write a C# (console) program to calculate the number of shipping labels that can be printed on a sheet of paper. This program will use a menu...
Create a C# .NET Core Console project in Visual Studio. (This is the same kind of...
Create a C# .NET Core Console project in Visual Studio. (This is the same kind of project we have been doing all semester.) Do all of the following in the Program class. You do not need to add any other classes to this project. 2. If it exists, remove the Console.WriteLine(“Hello World!”); line that Visual Studio created in the Program class. 3. At the very top of the Program.cs page you should see using System; On the empty line below...
write a small visual basic console program to output the ages of three students
write a small visual basic console program to output the ages of three students
write a c++ program using micro soft visual studio 2010 to write a program and store...
write a c++ program using micro soft visual studio 2010 to write a program and store 36 in variable x and 8 in variable y. add them and store the result in the variable sum. then display the sum on screen with descriptive text. calculate the square root of integer 36 in x. store the result in a variable. calculate the cube root of integer 8 in y. store result in a variable. display the results of square root and...
String Manipulator Write a program to manipulate strings. (Visual Studio C++) In this program take a...
String Manipulator Write a program to manipulate strings. (Visual Studio C++) In this program take a whole paragraph with punctuations (up to 500 letters) either input from user, initialize or read from file and provide following functionalities within a class: a)   Declare class Paragraph_Analysis b)   Member Function: SearchWord (to search for a particular word) c)   Member Function: SearchLetter (to search for a particular letter) d)   Member Function: WordCount (to count total words) e)   Member Function: LetterCount (ONLY to count all...
1. Make a Console App (.NET Core) in Visual Studio and name it as A1YourFirstnameLastname. 2....
1. Make a Console App (.NET Core) in Visual Studio and name it as A1YourFirstnameLastname. 2. Implement a vehicle rental management system which is capable of doing the following: • View all, available and reserved vehicles. • Reserve vehicle or cancel a reservation. 3. The application must be menu-based app: 1 - View all vehicles 2 - View available vehicles 3 - View reserved vehicles 4 - Reserve a vehicle 5 - Cancel reservation 6 - Exit 4. NOTE: At...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT