Solved

New to JAVA

Posted on 2006-10-22
4
234 Views
Last Modified: 2010-03-31
hi, i m new to java and would like to learn more about java.
Currently, i saw a website about temperature system.
Can anyone help me to show the working how to do the coding in java?

In this problem you will write a program that recommends sporting events based on a given temperature, from -20 to 110 degrees farenheit. The temperature is entered in the keyboard by the user of the program. The basis of the recommendation is:

swimming >= 75 degrees
tennis 60 < temperature <= 85
skiing 10 < temperature <= 32
checkers <= 10 degrees
soccer 32 < temperature <= 70
For example, if the temperature is 65 degrees, you program would recommend tennis and soccer.

Here is how you go about writing this program.

First, write a class named Exercise that includes three private, non-static variables. These variables are to be named lowtemp, hightemp and name. You will have to decide how to represent these variables and which access methods and/or constructors are needed.

Second, write a class named Activities that includes the following private, non-static variables: swimming, tennis, skiing, checkers, and soccer. Each of these variables are to be references to their own instance of an Exercise class. The instance of the Exercise class to which each refers is to have its lowtemp, hightemp and name variables set to values based on the information provided above for the temperatures for each activity. You must add at least one additional activity, though you can add more. This additional activity can be your favorite activity.

Third, write a program that uses a single instance of the Activites class to make recommendations for activities. Us eyour existing methods to read in a value within the reasonable range of temperatures and gracefully handle any cases where the value entered is not a reasonable temperature. By gracefully handle, your program should inform the user of the problem and allow the user to enter another value. Once a reasonable temperature is entered, have your program display which activities, based on the settings of the lowtemp and hightemp variables associated with each activity, are reasonable for that temperature.

0
Comment
Question by:icecubez78
  • 2
4 Comments
 
LVL 24

Accepted Solution

by:
sciuriware earned 500 total points
ID: 17783786
1st do a basic tutorial on JAVA, otherwise it's like driving Formula 1 with your coat on your arm.

2nd do your own homework!

The decisions you talk about can be made based on   if    statements.
Read about that and come back later.

You should have this question deleted to use the points in a better way than this.

;JOOP!
0
 
LVL 16

Expert Comment

by:HackneyCab
ID: 17785639
Yeah, you really should do your own homework.

All the students on my degree course that copied their homework from somewhere else ended up dropping out of the course, or being told they hadn't scored highly enough to progress to the next year. And if you're going to spend a year on a study course only to fail at the end of the year, it's a waste of your own time. Either change to a course that you are passionate about, or drop out and start getting work experience. Work experience is real important to recruitment types. Trust me on this one.
0
 

Author Comment

by:icecubez78
ID: 17785800
thanks sciuriware, i used the constructor and if-else statements. it does seems to be work. thank you..i will try to do on my own. since my personal learning to teach myself more about java. anyhow, i am not doing my homework and i am not a student. i saw my cousin doing his homework and find out quite interesting. but i still couldn't get the solution myself. so, i try to ask from here. thanks again for your advice.
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 17786643
Ok, come back to us when you have a programming problem.
In the meantime download and follow this course:

http://java.sun.com/docs/books/tutorial/information/download.html

To help you debug your programs easily download ECLIPSE from:

www.eclipse.org

Enjoy, we are here to help you, not to help ourselves.

;JOOP!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
hibernate insert example 13 37
Android development question 2 75
jmss example java 2 31
Setup GlassFish 4 34
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question