Project #1

CMSC 131

Due:  Friday, 2/17 at 11:00 pm

Object-Oriented Programming I

Type of project: Open

Spring 2012


System Design Decisions

Objective

This project will allow you to practice variables, strings, input/output facilities, conditional statements, logical operators, and the Eclipse IDE.

 

Overview

You will write a very simple application that asks the user to answer three questions about how the computer will be used and you will tell them how many units of memory they need to get in order to support that task.  Your program will prompt for and find out from the user the values for the three properties:

1.      The number of users the system will need to host.

2.      The operating system their computer is using - this is a String: "mac" or "linux" or "windows"

3.      The average number of processors each user will have running at one time.

You may assume that the correct type of input will be typed by the user. You can also assume that anytime an invalid piece of information is given a message should be printed and no further input should be expected (more details below).

This project is considered "open". Please visit the course web page for information regarding the open/closed policy for projects of this course. 

Specifications 

The program begins by prompting the user asking for the number of users that will be concurrently using the system using the exact prompt:

Users?

You may assume that the user will respond to this prompt by typing an integer and then pressing the enter/return key. The information the user types should appear on the line after the prompt (not on the same line). 

If any value less that 1 is typed, the exact message should print followed immediately by program termination:

None needed

If any value greater than or equal to 50 is typed, the exact message should print followed immediately by program termiation:

Impossible

If a value between 1 and 49 (inclusive) is typed, the program should then prompt for the next property with the exact message below:

System?

You may assume that the user will respond to this prompt by typing a string (one or more characters - containing no white space) and then pressing the enter/return key.  The user's input should appear on the line after the prompt, not on the same line. If anything besides "windows", "linux" or "mac" is typed, the exact message below must appear and the processing should stop without requesting further information.  [Note: The typed line must be exactly as shown (in lower case) - anything else is considered invalid.  The user will not type additional spaces before or after the text of the line.]

Impossible

If a valid value is given for the String input, the program should then prompt for the next property with the exact message below:

Processes?

You may assume that the user will respond to this prompt by typing an integer literal and then pressing the enter/return key.  The response typed by the user should appear on the line after the prompt (not on the same line). If zero or any negative value is typed, the exact message below must appear and the processing should stop without doing any further evaluation of the data already entered.

Impossible

If the product of the number of users and the number of processes is greater than 100, the exact output shown below should print and processing should stop without doing any further evaluation of the data.

Impossible

If the product is between 1 and 100 (inclusive) the number of units of memory is determined by the following chart:

 

linux

1-49

1 unit

 

50-100

2 units

mac

1-25

1 unit

 

26-60

2 units

 

61-100

3 units

windows

1-30

1 unit

 

31-50

2 units

 

51-75

3 units

 

76-100

4 units

Once the number of units is calculated, the exact message below should be printed where the www is replaced by the operating system as typed by the user, the xxx is replaced by the number of users as typed by the user, the yyy is replaced by the number of processes as typed by the user, and the zzz is the calculated number of units needed (printed as an integer). (Note: the term "units" even when there is only one.)

 

On www with xxx users each running yyy processes, you will need zzz units of memory.

Getting Started

In order to help you get started, we have defined an WhichSystem class with a main( ) method in a file named WhichSystem.java. This file can be retrieved by checking out the project called Spring12Proj1 from the CVS repository. Remember that you must have set up your repository in order to check out and submit projects.  (Refer to Project #0 for more specific instructions.)   After checking out the project, switch over to Java perspective to open the source-code file and begin working on it.

If you write the project from scratch, without checking out the "Spring12Proj1" files from your CVS repository, you will not be able to submit your work.

Requirements

 

Submission

*         Submit your project from Eclipse by right-clicking the project folder and selecting "submit".  You may submit as many times as you want -- we only grade your most recent submission.  After you have submitted your project, you should visit the submit server.  There you can obtain limited feedback about how well your project is performing.  The number of times you can run our tests on your project (before the due date) is limited.  The earlier you begin working on the project, the more opportunities you will have to see how your project performs on our tests before the due date!

Grading

*         There are several public tests and several release tests that will be run on your project.  Together, these tests will dictate 90% of the grade on the project.  The remaining 10% will be based on your use of correct programming style.

Sample Runs

The following examples show how your program should behave.  Note that items that are in underlined and in green represent the things that are entered by the user.  Keep in mind these are just examples and not the only scenarios that your program is expected to handle.  The first of these examples correspond to the "public tests" on the submit server  -- the rest are just to give you other options for testing but do not correspond to any testing on the submit server.

Example 1: 

Users?

99

Impossible

 

Example 2:

Users?

0

None needed 

 

Example 3:

Users?

1

System?

linux

Processes?

2

On linux with 1 users each running 2 processes,

you will need 1 units of memory. 

 

Example 4:

Users?

2

System?

mac

Processes?

99

Impossible

 

Example 5:

Users?

5

System?

linux

Processes?

10

On linux with 5 users each running 10 processes,

you will need 2 units of memory. 

 

Example 6:

Users?

2

System?

mac

Processes?

30

On mac with 2 users each running 30 processes,

you will need 2 units of memory.

 

Web Accessibility