CS105 Assignment #1
Computer Programming in C# Spring 2007

Assignment #1 - OOP in C# and Visual Studio.NET

Due: Wednesday, January 31 at 11:59pm

This assignment is intended to get you started on using Visual Studio.NET and give you some experience in basic object-oriented programming in C#.

Before You Begin

This assignment will need to be completed using Visual C# 2005. As noted in the course syllabus, Visual Studio.NET is installed in the Microlab machines in Painter Hall. You may use these machines to complete the assignment or alternatively, you may use your own copy of Visual C# 2005. The Pro, Standard, and Express editions will all work equally well for this assignment.

Used Car Dealership Inventory

Your task is to create a simple text-based "Console Application" in C# to maintain a catalog of used cars. The catalog keeps track of each car's make, model, year, and sale price.

The program begins with an empty catalog. The user is prompted to enter one of three possible commands:

If an unknown command is entered, the user should be informed and asked to enter another command. If the add or list commands are entered, the operation for that command is carried out, then the user is prompted for another command. The application continues until the quit command is entered.

The add command

If the add command is entered, the user will then be prompted to enter the car's make, model, year, and sales price, one-by-one. The make (e.g. Isuzu) and model (e.g. Trooper) can be arbitrary strings, while the year (e.g. 1990) should be an integer and the sales price (e.g. 2599.99) should be a floating point value. After the data is entered, the record should be stored in memory to be recalled later by the list command. You may assume that the catalog will never hold more than 20 cars.

You are not required to do any error checking on the data that is entered. For the purpose of keeping the assignment simple, the program may behave arbitrarily badly if the user enters improperly formatted input.

The list command

If the user enters the list command, the contents of the catalog should be displayed to the screen, nicely formatted. The format of the output should resemble the example trace below. Regardless of the precision of the stored sales price, the value should be formatted in dollars and cents. If no items exist in the catalog, the command should output a message stating so. Otherwise, after printing out the details of each car, the number of cars and total price of all cars should be printed.

Example program trace
Welcome to Mullet Joe's Gently Used Autos!

Enter command: show

Sorry, but "show" is not a valid command. Please try again.

Enter command: list

  There are currently no cars in the catalog.

Enter command: add
Make: Volkswagen
Model: Jetta
Year: 1999
Sales Price ($): 9450

Enter command: add
Make: Toyota
Model: Prius
Year: 2006
Sales Price ($): 27999.90

Enter command: list

1999 Volkswagen Jetta          $9,450.00
2006 Toyota Prius             $27,999.90

Number of cars: 2
Total inventory:              $37,449.90

Enter command: quit

  Good bye!
Extending the assignment

For extra practice, feel free to extend this assignment in any way that you choose. Some example extensions include adding a "delete" command or the ability to sort the cars in the catalog by year or price.

Grading

The assignment will be graded on its completeness (all mandatory functionality is present), correctness (included functionality behaves as intended) and coding style. To receive full points for coding style, the code should be well-organized, algorithms should be implemented in a reasonable way and C# naming conventions should be followed.

Submission

The assignment may be implemented in a single .cs file or in multiple files. However, the file containing the "Main" method to be run must be called "Assign1.cs". All .cs files for the assignment should be submitted via the microlab web turnin application. Please do not submit any project files other the .cs source files.


Get Firefox! Valid HTML 4.01! Last Modified Sun Jan 21 23:56:07 CST 2007