I need to write an application that reads three intergers and prints their average, 2- write an application that reads two floating point numbers and prints their sum, difference, and product. I am doing programming projects in Java software solutions 5th edition for school.

_______________________-
SEO

Recommended Answers

All 5 Replies

Get user entered input data from keyboard. Use BufferedReader and InputStreamReader classes to receive the intput data.
Convert user entered String type value to appropriate type value .
compute data and display the result

commented: be think on problem +0

what you need is this...
do second one first...
set 2 attributes: double x
double y

methods you should programme are: constructors
getX()
getY()
setX()
setY()
toString()

first one...
create a class with 3 attributes which are all doubles...
create the same as above except in the toString, instead of a list of calculations (pm me if you are unsure about this) seperated with the "\n" aswell as the + signs...just create the sum for average using the 3 inputs.
need any further help then pm me please, as I am beginning to wonder if this forum is a joke due to flamers as theres only one person offered to help me since I joined when I have answered quite some threads for my first day

you can add two integers in java simply by

class javaa
{


}
class javaa
{ 
double x;
double y;
double z;
javaa(int x,int y,int z)
{
this.x=x;
this.y=y;
this.z=z;
}
double setx()
{
this.x=x;
}
double getx()
{
return this.x;
}
double sety()
{
this.y=y;

}
double gety()
{
return y;
}
double setz()
{
this.z=z;
}
double getz()
{
return this.z;
}
double average()
{
double av;
av=(x+y+z)/3;
return av;


}

}


}
class driver
{
public static void main(String []args)
{
javaa j=new javaa(1,2,3);
j.av();

}
}
public static void main(String []args)
{
javaa j=new javaa(1,2,3);
j.av();
}

Actually you need to call the average() method because there is no method: [U]av[/U] declared in the class.

Also next time if you want code tags, please click the button labeled [code] ,when you create a new post

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.