English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

import java.io.*;

public class Activities extends Exercise{

public static Activities swimming= new Activities();
public static Activities tennis= new Activities();
public static Activities bowling= new Activities();

public static void main(String[] args) {


BufferedReader input=new BufferedReader (new

InputStreamReader(System.in));


swimming.setName("swimming");
swimming.setLowTemp(75);
swimming.setHighTemp(120);


tennis.setName("tennis");
tennis.setLowTemp(60);
tennis.setHighTemp(85);

tennis.setName("bowling");
tennis.setLowTemp(20);
tennis.setHighTemp(50);

Activities acts = new Activities();
_/*
In This line you need to put the temperature to evaluate then the

2006-11-21 12:00:55 · 5 answers · asked by Anonymous in Computers & Internet Programming & Design

*/

acts.printAllowedActivities(100);



}

public void printAllowedActivities(int temp) {
if (temp > swimming.getLowTemp() && temp <

swimming.getHighTemp()) {
System.out.println("Swimming is good for this temp");
}
if(temp>tennis.getLowTemp() && temp < tennis.getHighTemp()) {
System.out.println("Tennis is good for this temp");
}

if(temp>bowling.getLowTemp() && temp < bowling.getHighTemp()) {
System.out.println("Bowling is good for this temp");
}
}

public void inputTemperature(){
int temperature;
String activities=new String();
Scanner input = new Scanner ( System.in );
System.out.print("\nEnter the temperature: ");

if (temperature >= 75) {
activities = "swimming";
}
else if(temperature > 60 && temperature <= 85){
activities = "tennis";
}

else if (temperature >=-21 && temperature <=111 ){
activities = "no activities";

2006-11-21 12:02:27 · update #1

System.out.println("Activities = " + activities);
}
}*/
}


class Exercise {
private int lowtemp;
private int hightemp;
private String name;



public void setLowTemp( int lowt)
{
lowtemp = lowt;
}

public int getLowTemp()
{
return lowtemp;
}

public void setHighTemp( int hight)
{
hightemp = hight;
}

public int getHighTemp()
{
return hightemp;
}

public void setName( String n)
{
name = n;
}

public String getName()
{
return name;
}




public void displayMessage()
{
System.out.println("Please enter the temperature"+ getLowTemp());
System.out.println("Please enter the temperature"+ getHighTemp());
System.out.println("Please enter the temperature"+ getName());

}
}

2006-11-21 12:02:53 · update #2

i'm using jdk1.3

2006-11-21 12:13:13 · update #3

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\User>cd\

C:\>path=c:\jdk1.3\bin

C:\>cd my debug
The system cannot find the path specified.

C:\>cd debug

C:\debug>cd\

C:\>path=c:\jdk1.3\bin

C:\>cd debug

C:\debug>javac exercise.java
exercise.java:32: ';' expected
acts.printAllowedActivities(100);
^
exercise.java:51: expected
_/*public void inputTemperature(){
^
exercise.java:3: class Activities is public, should be declared in a file named
Activities.java
public class Activities extends Exercise{
^
exercise.java:51: cannot resolve symbol
symbol : class _
location: class Activities
_/*public void inputTemperature(){
^
exercise.java:29: cannot resolve symbol
symbol : class _
location: class Activities
_/*
^
exercise.java:32: acts is already defined in main(java.lang.String[])
acts.printAllowedActivities(100);
^
6 errors

C:\debug>^A

2006-11-21 12:43:04 · update #4

5 answers

we will need the error list to help you fix this.

2006-11-21 12:36:57 · answer #1 · answered by srihari_reddy_s 6 · 0 0

public static void menu(); // <= eliminate that semicolon The compiler treats this as then end of the fact and so it expects the subsequent line to be a clean fact. maximum statements initiate with an identifier, subsequently the message. What you have inadvertantly executed is define a important technique that's empty and, when you consider which you're interior the class, it extremely is anticipating the two declearations of occasion variables or strategies. the two considered one of which initiate with an identifier. blunders messages many times look on the line after the blunders. when you consider that an empty important technique is criminal that mistake isn't an blunders interior the experience of what the compiler detects. it extremely is a mistake interior the experience that it is not what you meant to do. while debugging continually look on the line in the present day preceeding the line the place the blunders occurs to be certain if that line is definitely the reason.

2016-11-25 23:51:32 · answer #2 · answered by ? 4 · 0 0

Why not try going to the website and downloading an updated version! Peace!

2006-11-21 12:06:25 · answer #3 · answered by lainey lain 5 · 0 0

just remove the underscore '_' at the line:
_/* In This line you need...
and then save your file under the name Activities.java

2006-11-21 13:06:44 · answer #4 · answered by KokYee 2 · 0 0

Unless you show us what the compiler output was I don't think we can help you... :-(

2006-11-21 12:04:01 · answer #5 · answered by clueless_nerd 5 · 0 0

fedest.com, questions and answers