Vince Travis Sillhouette Angeles
Create a myMath class that contains the ff procedures and or methods
1. Add any number of numbers
2. Multiply any number of numbers
3. Raise a number to the nth power
4. Slope of a line given 2 points
5. Factors of a whole number
6. Acceleration of an object given any number of velocities
7. Density of an object given its mass and weight
8. Force in Newton's given mass and acceleration
9. Determine if a number is even
10. Determine if a number is prime
* put your own comments on the code
* use appropriate naming conventions
* use appropriate return type and return value
* use appropriate parameter list

...if someone can program this... thanks a lot..
and merry christmas

What questions do you have about writing this code?
Do you have problems, please post them.

Member Avatar for hfx642

Lots of us here CAN. It doesn't mean that we WILL!
I have my own projects to work on.
Besides... I have to do some baking this weekend.
Those "Christmas Pies" won't make themselves!!

There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in doing your homework for you.

DaniWeb Member Rules include:
"Do provide evidence of having done some work yourself if posting questions from school or work assignments"
http://www.daniweb.com/forums/faq.php?faq=daniweb_policies
http://www.daniweb.com/forums/announcement8-2.html

Member Avatar for hfx642

Besides... EACH of those tasks are quite easy to code.
Why don't you do them yourself.

Create a myMath class that contains the ff procedures and or methods:
1. Add any number of numbers
2. Multiply any number of numbers
3. Raise a number to the nth power
4. Slope of a line given 2 points
5. Factors of a whole number
6. Acceleration of an object given any number of velocities
7. Density of an object given its mass and weight
8. Force in Newton's given mass and acceleration
9. Determine if a number is even
10. Determine if a number is prime
* put your own comments on the code
* use appropriate naming conventions
* use appropriate return type and return value
* use appropriate parameter list

...if someone can program this... thanks a lot..
and merry christmas...

I Programmed This using NetBeans IDE but I dont Know How To Program The Others ...
I only Program what i know...
Heres my Program:
Kindly Check and Edit It if you have Time Thankzz...

public class myMath {
  public static void main(String[] args) {

  int sum = Add(5,3,2); 
  System.out.println("the sum is " +sum);

  int product = Multiply(4,3);
  System.out.println("the product is " +product);

  float slope = Slope(4,3,5,6);
  System.out.println("the slope is " +slope);

  int RaiseValue = raisenumber(2,6);
  System.out.println("the Raised Value is " +RaiseValue);

  String evenNum = Even(8);
  System.out.println(evenNum);
  }

  public static int Add(int...num){
  int sum=0;
  for(int number : num){
  sum = sum + number;}
  return sum;
  }

  public static int Multiply(int...num){
  int product=1;
  for (int number : num)
  product= product*number;
  return product;
  } 

  public static float Slope(float x1, float y1,float x2, float y2){
  float slope;
  slope=(y2-y1)/(x2-x1);
  return slope;
  }

  public static String Even(int num){
  String evenNum;
  if(num%2 == 0){
  evenNum="the number is Even";}
  else
  evenNum="the number is Odd";
  return evenNum;
  }

  public static int raisenumber(int num,int power){
  int RaiseValue=1;
  for(int x=1; x<=power; x++){
  RaiseValue=RaiseValue*num;}
  return RaiseValue;
  }
  }

yes, but what questions do you have except for: can anyone code my homework before I have to hand it in?

what's the code you tried that isn't working? what error messages do you get?

"If" he has no problem with the code he posted then the remaining problems he wants suggestions must be from numbers 10,8,7,6,5

5. Factors of a whole number
Divide the n number by numbers ranging from 1 to n using a modulo then check if the answer is equal to 0, if not then list down the number

6. Acceleration of an object given any number of velocities
Is time given?

7. Density of an object given its mass and weight
Convert weight to volume then divide mass from the volume

8. Force in Newton's given mass and acceleration
F=m*a... Is it that hard?

10. Determine if a number is prime
You need to check if the given number is not divisible by any number other than itself or 1 so divide the number ranging from 2 to the number before the given number using a modulo...if one of the answers is equal to 0 then its not a prime number

Member Avatar for v3ga

7.Density can't be calculated from mass and weight, weight= force by earth= mass * g, no way to get volume
5&10. Don't check for all numbers upto n, n/2 or sqrt(n) is enough right?

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.