Project #1

CMSC 131

Due:  Tuesday, 2/23 at 11:00 pm

Object-Oriented Programming I

Type of project: Open

Spring 2010


Do You Have The Power???

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 identify three properties of the task they need to do and you will tell them if they have enough processing power to do that task or not.  Your program will prompt for and find out from the user the values for the three properties:

1.      The number of processes they want to run concurrently - this is an integer.

2.      The operating system their computer is using - this is a String: "Windows XP" or "Windows 7" or "Vista"

3.      The amount of processing power their computer system has - this is a double.

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

Your program knows several processing limitations: 

·        If you are running 1 application

-         Windows XP - must have more than 300 units of power

-         Windows 7 - must have more than 500 units of power

-         Vista - must have more than 800 units of power

·        If you are running 2 applications

-         Windows XP - must have more than 500 units of power

-         Windows 7 - must have more than 800 units of power

-         Vista - must have more than 1000 units of power

·        For more than 2 applications, 50 units of power is needed for each application beyond the amount needed for the first 2.  This means that on the Vista system where you need to run 5 applications concurrently, you will need 150 (calculated as 3 * 50)) over the amount for 2 applications; in other words you must have more than 1150 units of power.  A second example: on the Windows XP system where you need to run 12 applications concurrently, you must have 500 (calculated as 10*50) above the amount needed for 2 applications on that system - which means you need over 1000 units of power.

 

The program begins by prompting the user asking for the number of applications with the exactly the following prompt:

Type the number of applications you will be running:

You may assume that the user will respond to this prompt by typing an integer and then pressing the enter/return key.  If any negative integer is typed or any integer greater than 20 is typed, the exact message below must appear and the processing should stop without requesting further information.

Invalid Entry

If a value of zero is given, the program should tell the user that of course he has enough power to run nothing with the exact message:

Enough Power

If a valid value other than zero was given, the program should then prompt for the next property with the exact message below:

Type the Operating System you will be using:

You may assume that the user will respond to this prompt by typing a string (one or more characters possibly containing white space) and then pressing the enter/return key.  If anything besides "Windows XP", "Windows 7" or "Vista" 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 capitalization and in spacing - anything else is considered invalid.  The user will not type additional spaces before or after the text of the line, but additional spaces within a line should be considered a different String ("Windows       XP" is not the same as "Windows XP") Notice: Vista does not contain the word Windows.]

Invalid Entry

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

Type the Power you have on that system:

You may assume that the user will respond to this prompt by typing a floating point literal (a valid double) and then pressing the enter/return key.  If 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.

Invalid Entry

If a valid value for the amount of power is given, the program should then determine if there is enough processing power for that many concurrent applications, in that operating system.

If there is enough processing power (based on the chart above), the program must print the exact message:

Enough Power

If there is not enough processing power (based on the chart above), the program must print the exact message:

Can Not Run

 

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 Spring10Proj1 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 "Spring10Proj1" 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 ten 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 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: 

Type the number of applications you will be running:30

Invalid Entry

 

Example 2:

Type the number of applications you will be running:0

Enough Power

 

 

Example 3:

Type the number of applications you will be running:1

Type the Operating System you will be using: Windows XP

Type the Power you have on that system: 400

Enough Power

 

Example 4:

Type the number of applications you will be running:1

Type the Operating System you will be using: Windows XP

Type the Power you have on that system: 100.5

Can Not Run

 

Example 5:

Type the number of applications you will be running:20

Type the Operating System you will be using: Vista

Type the Power you have on that system: 1000

Can Not Run

 

Example 6:

Type the number of applications you will be running:-45

Invalid Entry

 

Example 7:

Type the number of applications you will be running:12

Type the Operating System you will be using: Windows Vista

Invalid Entry

 

Example 8:

Type the number of applications you will be running:14

Type the Operating System you will be using: Windows 7

Type the Power you have on that system: 0.567

Can Not Run

 

Example 9:

Type the number of applications you will be running:14

Type the Operating System you will be using: Windows 7

Type the Power you have on that system: -45

Invalid Entry

 

Web Accessibility