Assignment 2: Letters and Numbers in Java: Problem 1 (30 Points) : Rolling A Dice
Assignment 2: Letters and Numbers in Java: Problem 1 (30 Points) : Rolling A Dice
CSCI-UA 101
Assignment 2
1
2
3
4
5
6
was
was
was
was
was
was
rolled
rolled
rolled
rolled
rolled
rolled
16.5000%
16.7000%
17.1000%
15.4000%
17.0000%
17.3000%
of
of
of
of
of
of
the
the
the
the
the
the
times.
times.
times.
times.
times.
times.
The numbers should be displayed with exactly four decimal places followed by a percent sign.
Call your file Dice.java.
Note 1: Your numbers should add up to about 100, but may not add up to exactly 100.
Note 2: This program is not interactive. It does not take any input from the user.
Enter a character: Z
Z is a consonant.
Enter a character: e
e is a vowel.
Enter a character: *
* is not a letter.
Call your file: Letters.java.
Note 1: You should read chapter 4 before attempting this problem.
Note 2: Think the problem through. The task of determining if the letter is a consonant or a vowel can be solved in many ways:
some of them are much longer to implement than others (you should try to find a short way).
Joanna Klukowska
[email protected]
CSCI-UA 101
Assignment 2
Grading
Does the program compile? If not, you will loose all the points for that problem.
Is the program properly documented? (worth ~20% of each problem)
Proper documentation includes:
preamble with the name of the author, date of creation and brief description of the program;
appropriately chosen variable names, i.e., descriptive names;
comments inside the code describing steps needed to be taken to accomplish the goal of the program;
appropriate formatting, indentation and use of white space to make the code readable.
Remember that the code is read by humans and it should be easy to read for people who were not involved in its development.
Is the program well developed? (worth ~40% of each problem) Make sure you create variables of appropriate types, use
control statements (conditionals and loops) that are appropriate for the task, accomplish your task in a well designed and simple
way (not a convoluted algorithm that happens to produce the correct output for some unknown reason). You should also design
a friendly and informative user interface.
Is the program correct? (worth ~40% of each problem), Make sure that your program produces valid results that follow the
specification of the problem every time it is run. At this point you can assume a well behaved user who enters the type of
data that you request. If the program is not completely correct, you get credit proportional to how well it is developed and how
close you got it to the completely correct code.
Questions
Post any questions you have regarding this assignment to Piazza under the homeworks topic.