6 Replies - 798 Views - Last Post: 26 October 2009 - 02:12 PM Rate Topic: -----

#1 sampsoni  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 56
  • Joined: 25-October 09

Can you help me with this Java code?

Posted 25 October 2009 - 06:40 PM

Can you please help me with Java code. I have a mission, to convince a computer science professor at Kennesaw State University that I will probably have no trouble mastering Java, and if he says that, then I can get a MacBook Pro with high processors, gigabytes of memory, good graphics processors to play HD videos on Youtube or video sites, and an Intel processor so I can use Parallels Desktop to run Windows apps and games. I've did Programming Projects Ch.3 in my Java book, now I want to do Programming Projects Ch. 4, but I completely stalled on the first one, now people are going to call me a "n00b" as they type it in on comments and texting. Here's the code:

import java.util.Scanner;
/**
 *
 * @author jordanwhite
 */
public class MultiSphere {

	/**
	 * @param args the command line arguments
	 */
	public static void main(String[] args) {
		int hairraiser1, hairraiser2, hairraiser3, sell, sell2;
		Sphere ball_1;
		Scanner jack;

		ball_1 = new Sphere();


		ball_1.setDiameter();
		


		hairraiser2 = ball_1.getVolume();
		hairraiser3 = ball_1.getSurface();

		System.out.println ();
		System.out.println ("Volume: " + hairraiser2);
		System.out.println ("Surface: " + hairraiser3);
	}

}



For the class that should go with it:

import java.util.Scanner;
/**
 *
 * @author jordanwhite
 */
public class Sphere{
	private int diameter, volume, surface, radius;

	public void setDiameter (Scanner diam, int length){
		diameter = length;
		diam = new Scanner (System.in);
		System.out.println("Enter Diameter: " + diam);
		length = diam.nextInt();

	}

	public int getDiameter(){
		return diameter;
	}

	public int getVolume(){
		radius = diameter / 2;
		volume = (int) (4 / 3 * Math.PI * Math.pow(radius, 3));

		return volume;
	}

	public int getSurface(){
		surface = (int) (4 * Math.PI * Math.pow(radius, 2));

		return surface;
	}


	public String toString(){
		String result1 = Integer.toString(volume, surface);

		return result1;
	}

}



Do you think that would be all, and an awesome Black Label Beer animation?:

1950s Black Label Beer commercial

Not only am I a computer science fan, but also an animation fan. I actually saw Toy Story when it came out when I was 4 years old. Have been a fan of Pixar ever since. They're another reason why I got into computers. So, can you please help me with this code?

Is This A Good Question/Topic? 0
  • +

Replies To: Can you help me with this Java code?

#2 sampsoni  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 56
  • Joined: 25-October 09

Re: Can you help me with this Java code?

Posted 25 October 2009 - 06:40 PM

Can you please help me with Java code. I have a mission, to convince a computer science professor at Kennesaw State University that I will probably have no trouble mastering Java, and if he says that, then I can get a MacBook Pro with high processors, gigabytes of memory, good graphics processors to play HD videos on Youtube or video sites, and an Intel processor so I can use Parallels Desktop to run Windows apps and games. I've did Programming Projects Ch.3 in my Java book, now I want to do Programming Projects Ch. 4, but I completely stalled on the first one, now people are going to call me a "n00b" as they type it in on comments and texting. Here's the code:

import java.util.Scanner;
/**
 *
 * @author jordanwhite
 */
public class MultiSphere {

	/**
	 * @param args the command line arguments
	 */
	public static void main(String[] args) {
		int hairraiser1, hairraiser2, hairraiser3, sell, sell2;
		Sphere ball_1;
		Scanner jack;

		ball_1 = new Sphere();


		ball_1.setDiameter();
		


		hairraiser2 = ball_1.getVolume();
		hairraiser3 = ball_1.getSurface();

		System.out.println ();
		System.out.println ("Volume: " + hairraiser2);
		System.out.println ("Surface: " + hairraiser3);
	}

}



For the class that should go with it:

import java.util.Scanner;
/**
 *
 * @author jordanwhite
 */
public class Sphere{
	private int diameter, volume, surface, radius;

	public void setDiameter (Scanner diam, int length){
		diameter = length;
		diam = new Scanner (System.in);
		System.out.println("Enter Diameter: " + diam);
		length = diam.nextInt();

	}

	public int getDiameter(){
		return diameter;
	}

	public int getVolume(){
		radius = diameter / 2;
		volume = (int) (4 / 3 * Math.PI * Math.pow(radius, 3));

		return volume;
	}

	public int getSurface(){
		surface = (int) (4 * Math.PI * Math.pow(radius, 2));

		return surface;
	}


	public String toString(){
		String result1 = Integer.toString(volume, surface);

		return result1;
	}

}



Do you think that would be all, and an awesome Black Label Beer animation?:

1950s Black Label Beer commercial

Not only am I a computer science fan, but also an animation fan. I actually saw Toy Story when it came out when I was 4 years old. Have been a fan of Pixar ever since. They're another reason why I got into computers. So, can you please help me with this code?
Was This Post Helpful? 0
  • +
  • -

#3 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8315
  • View blog
  • Posts: 31,836
  • Joined: 06-March 08

Re: Can you help me with this Java code?

Posted 25 October 2009 - 06:45 PM

Duplicated topcs merged
Please avoid duplicated topics :angry:
Was This Post Helpful? 0
  • +
  • -

#4 sampsoni  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 56
  • Joined: 25-October 09

Re: Can you help me with this Java code?

Posted 26 October 2009 - 12:52 PM

All right.
Was This Post Helpful? 0
  • +
  • -

#5 sampsoni  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 56
  • Joined: 25-October 09

Re: Can you help me with this Java code?

Post icon  Posted 26 October 2009 - 12:54 PM

Can you please help me with Java code. I have a mission, to convince a computer science professor at Kennesaw State University that I will probably have no trouble mastering Java, and if he says that, then I can get a MacBook Pro with high processors, gigabytes of memory, good graphics processors to play HD videos on Youtube or video sites, and an Intel processor so I can use Parallels Desktop to run Windows apps and games. I've did Programming Projects Ch.3 in my Java book, now I want to do Programming Projects Ch. 4, but I completely stalled on the first one, now people are going to call me a "n00b" as they type it in on comments and texting. Here's the code:

import java.util.Scanner;
/**
 *
 * @author jordanwhite
 */
public class MultiSphere {

	/**
	 * @param args the command line arguments
	 */
	public static void main(String[] args) {
		int hairraiser1, hairraiser2, hairraiser3, sell, sell2;
		Sphere ball_1;
		Scanner jack;

		ball_1 = new Sphere();


		ball_1.setDiameter();
		


		hairraiser2 = ball_1.getVolume();
		hairraiser3 = ball_1.getSurface();

		System.out.println ();
		System.out.println ("Volume: " + hairraiser2);
		System.out.println ("Surface: " + hairraiser3);
	}

}



For the class that should go with it:

import java.util.Scanner;
/**
 *
 * @author jordanwhite
 */
public class Sphere{
	private int diameter, volume, surface, radius;

	public void setDiameter (Scanner diam, int length){
		diameter = length;
		diam = new Scanner (System.in);
		System.out.println("Enter Diameter: " + diam);
		length = diam.nextInt();

	}

	public int getDiameter(){
		return diameter;
	}

	public int getVolume(){
		radius = diameter / 2;
		volume = (int) (4 / 3 * Math.PI * Math.pow(radius, 3));

		return volume;
	}

	public int getSurface(){
		surface = (int) (4 * Math.PI * Math.pow(radius, 2));

		return surface;
	}


	public String toString(){
		String result1 = Integer.toString(volume, surface);

		return result1;
	}

}



Do you think that would be all, and an awesome Black Label Beer animation?:

1950s Black Label Beer commercial

Not only am I a computer science fan, but also an animation fan. I actually saw Toy Story when it came out when I was 4 years old. Have been a fan of Pixar ever since. They're another reason why I got into computers. So, can you please help me with this code?
Was This Post Helpful? 0
  • +
  • -

#6 Momerath  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 996
  • View blog
  • Posts: 2,392
  • Joined: 04-October 09

Re: Can you help me with this Java code?

Posted 26 October 2009 - 01:47 PM

What kind of help are you looking for? You don't say what you are trying to accomplish and what problem you are having doing so.
Was This Post Helpful? 0
  • +
  • -

#7 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1633
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Can you help me with this Java code?

Posted 26 October 2009 - 02:12 PM

You were asked to not create duplicate topics, then went and did it (again) anyways. Topics merged (last time), do not create anymore threads regarding this issue.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1