Part A: (ungraded) If you haven't yet, do the following on-line jGRASP tutorials: overview, installation, getting started, and the debugger at http://www.jgrasp.org. If you want to use your own computer for assignments, install the sun JDK and (optionally) jGRASP on your machine. Directions are on the main course webpage.
Part B: (ungraded) If you haven't yet, read Chapters 1-3. Look at the review questions for each chapter. Recommended exercises to do on your own as practice for the midterm: 1-13, 2-5, 2-6, 3-6, 3-10, 3-11, 3-16. Write and run a JAVA program to check your answers. You are permitted to work together on any ungraded work for the course.
Part C: Complete the survey from part C of assignment #0 if you haven't yet.
Part D: [8 points] Read through programming assignment 1B and do the first phase: problem analysis. Write up two sample runs that show the complete user interface: all the input and output as it would appear if you were running the actual program you will write (similar to our GPA example). One sample run must use the input values that are given in the problem description.
For the other sample run, make up your own data that differs enough to demonstrate another case the program must be able to handle. Do the calculations by hand or with a calculator to figure out what the correct output will be. You must submit your sample runs on Blackboard as assignment w1 in a plain text file (not a Word document) named w1.txt. We will not collect a printout. A solution will be distributed via email after the deadline for help in writing and testing your actual program next Wednesday - absolutely no late submissions will be accepted.
Part A: Snowflake [10 pts]
Before graphical user interfaces and icons were common-place, we used plain character sequences to create "pictures" on computers, called "ASCII graphics". Write an application program that displays a snowflake of your design by printing lines of characters in a pattern that resembles one. Use String variables to hold any parts of the pattern that are repeated. For example, I might have my program display the following (somewhat lame) figure. Try to incorporate your initials into it somehow. Everyone's snowflake should be unique. There is no input for this program! Name your program pg1a.java and remember to submit it on Blackboard.
|
\ | /
>--o--<
/ | \
|
Part B: Exercise Planner [20 pts]
Suppose that you are pursuing a regular fitness regimen and want to plan and track your exercising based on calories burned. In this first version, we will restrict our data to the following types of exercise, and average numbers of calories burned/hour. (These are fictional values based on various websites; actual calories burned depends on your weight and the speed at which you do them.)
| Exercise | Calories/Hour |
|---|---|
| Running | 700 |
| Biking | 650 |
| Weight Lifting | 300 |
| Dancing | 400 |
This program will deal with planning a weekly regimen, taking into account how many calories you want to burn in one week, and how you would like to distribute your exercise among the activities above. Therefore the program user must input the total calories to burn in one week, and the percentage of calories for each of the activities above. For now we will expect the user to enter percentage data that adds up to exactly 100% for the week. Based on this data, your program must calculate and output how many calories must be burned per activity, and how many hours must be spent doing each activity in order to reach those goals. Lastly, your program should calculate and display the total and the average amount of time you will spend per activity. When displaying these values, give the time as (whole) hours (rounded down) and minutes (rounded up).
The following data must be given as input to the program:
Make sure your program is very user friendly. Include detailed prompts so that the user knows exactly what type of data to input, and nice descriptions and formats for the output. You should not use any Java constructs that we haven't covered in class (such as loops). Name your program file pg1b.java and be sure to follow all the assignment details below. Don't forget to submit two sample runs as instructed in part D of the warm-up assignment #1!
Development Hints: Here is an incremental coding approach to solving this problem. At each stage make sure the program compiles and runs correctly. If not, fix it before going to the next stage.
General assignment requirements, style and submission details: