Results 1 to 5 of 5
Like Tree2Likes
  • 2 Post By jim829

Thread: Please Help me! I have worked in this project for more than 12 hours!!!!

  1. #1
    Lupita1 is offline Member
    Join Date
    Sep 2013
    Posts
    2
    Rep Power
    0

    Question Please Help me! I have worked in this project for more than 12 hours!!!!

    Java Code:
    public class JProgramTwo
    {
    	public static void main(String[] UpRight)
    	{
    
    				
    
    				//DECLARE VARIEBLES and ASSIGNNING VALUES!
    			  	int Radius, Height, Edge, Lenght, Width, SideA, SideB, SideC, A, B, C, D, E, F, VSph, VCyl, VCub, VBox, Alg1, Alg2, ATri ;
    				Radius = 5; //this is for the sphere.
    				Height = 4; //use this one for the volume of the cylinder.
    				Edge   = 6; //Use this for the volume of the cube.
    				Lenght = 3; //box.
    				Width  = 7; //box.
    				Height = 8; //box.
    				SideA  = 6; //triangle side.
    				SideB  = 6; //triangle side.
      				SideC  = 1; //triangle side.
      				A      = 8; //fractions
    				B	   = 3; //fractions
    				C      = 4; //fractions
    				D      = 2; //fractions
    				E      = 1; //fractions
    				F      = 9; //fractions
    
    				VSph   = (4.0)/(3.0)*(Math.PI)*Radius*Radius*Radius;
    				VCyl   = Math.PI*Radius*Radius*Height;
    				VCub   = Edge*Edge*Edge;
    				VBox   = Lenght*Width*Height;
                                    Alg1   = 1.0*(A*B + C)/(D + E*F);
                                    Alg2   = 1.0*(A + B)/(C + D);
    				ATri   = 0.25*Math.sqrt( (SideA+SideB+SideC)*(SideB+SideC-SideA)*(SideA+SideC-SideB)*(SideB-SideC+SideA) );
    
    
    				//THE VOLUME OF THE SPHERE!
    				System.out.format("The volume of a sphere with given Radius                = " + VSph + "\n\n");
    				//cylinder
    				System.out.format("The volume of the cylinder with given Radius and Height = " + VCyl + "\n\n");
    				//CUBE!
    				System.out.format("The volume of a cube with a given Edge                  = " + VCub + "\n\n");
    				//BOX
    				System.out.format("The volume of the box with given Lenght, Width, Height  = " + VBox + "\n\n");
    				//ALGEBRAIC EXPRESSioNS
    				System.out.format("The expression (AB+C)/(D+EF)                            = " + Alg1 + "\n\n");
    				System.out.format("The expression  (A+B)/(C+D)                             = " + Alg2 + "\n\n");
    				//TRIANGLE!
    				System.out.println("The area of the triangle with three given sides        = "+ ATri  + "\n\n\n\n\n\n\n" );
    
    	}
    }
    //output:
    Please Help me!  I have worked in this project for more than 12 hours!!!!-output.png
    This output displays the numbers to 12+ decimal places. Please, please help me. I have worked on this for 12 hours and I have not gotten the desired results. The numbers must have three decimal places only and they must be right-justified. Please help me.

  2. #2
    agillator is offline Member
    Join Date
    Sep 2013
    Posts
    4
    Rep Power
    0

    Default Re: Please Help me! I have worked in this project for more than 12 hours!!!!

    Check the API documentation for String.format() and follow the link to the explanation of the format string. Although there is more than one way, the easiest for you is probably to convert your value to a string and then use the format() method.

  3. #3
    Lupita1 is offline Member
    Join Date
    Sep 2013
    Posts
    2
    Rep Power
    0

    Default Re: Please Help me! I have worked in this project for more than 12 hours!!!!

    Quote Originally Posted by agillator View Post
    Check the API documentation for String.format() and follow the link to the explanation of the format string. Although there is more than one way, the easiest for you is probably to convert your value to a string and then use the format() method.
    Please give me an example.

  4. #4
    agillator is offline Member
    Join Date
    Sep 2013
    Posts
    4
    Rep Power
    0

    Default Re: Please Help me! I have worked in this project for more than 12 hours!!!!

    I think no one is going to do your homework for you although people are willing to point you in the right direction. If you look at String (Java 2 Platform SE 5.0) you will easily see how to create a string and then you can see the explanation for the format method as I suggested.

  5. #5
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,414
    Rep Power
    5

    Default Re: Please Help me! I have worked in this project for more than 12 hours!!!!

    System.out is an instance of PrintStream. So check the PrintStream API to see how to use format. You are not using it correctly. It is absolutely critical that you learn to read and understand the API documentation. Otherwise you will definitely struggle learning Java.

    Regards,
    Jim
    DarrylBurke and gimbal2 like this.
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

Similar Threads

  1. have any one worked in json
    By javastuden in forum Java Servlet
    Replies: 0
    Last Post: 01-15-2013, 07:19 AM
  2. Simple Project 4 or 5 Hours – Pay $100
    By billaaa777 in forum Jobs Offered
    Replies: 0
    Last Post: 08-30-2008, 12:45 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •