Page 3 of 3 FirstFirst 123
Results 21 to 26 of 26
  1. #21

    Default Re: Java FLOWCHART Programming (Please Help)


    hay salamat.. im back na pud mga tol..

    here's my latest learning mga tol ug salamat kaayo..

    Code:
    public class Area {
    
        public static void main(String [] args)
        {
        	int length = 14;
        	int width = 7;
        	int area;
        	area = length * width;
    
        		System.out.println("The area of the room if it has a length of " +length+ " and a width of " +width+
        			" is = " +area+ "\n\n\n");
    
        }
    
    
    }
    This monday UserInput na daw mi,. can any1 give me samples of userinput source code for java please??

  2. #22

    Default Re: Java FLOWCHART Programming (Please Help)

    bumppppppp

  3. #23

  4. #24

    Default Re: Java FLOWCHART Programming (Please Help)


  5. #25

    Default Re: Java FLOWCHART Programming (Please Help)

    Basin mao ni imo pasabot, then buhatan ug pseudocodes then source codes in Java language.


  6. #26

    Default Re: Java FLOWCHART Programming (Please Help)

    I have an example using the class Scanner() not the class BufferReader(). It loops to 10 times. Maybe this might be useful to you.

    Code:
    public class GradeBookTest
     {
        public static void main( String args[] )
     {
     // create GradeBook object myGradeBook and
     // pass course name to constructor
        GradeBook myGradeBook = new GradeBook(
        "Introduction to Java Programming" );
    
     myGradeBook.displayMessage(); // display welcome message
     myGradeBook.determineClassAverage();
    
     } // end main
    
     } // end class GradeBookTest

    Code:
    import java.util.Scanner; 
    
    public class GradeBook
    {
       private String courseName; // name of course this GradeBook represents
    
       // constructor initializes courseName
       public GradeBook( String name )
       {
          courseName = name; // initializes courseName
       } // end constructor
    
       // method to set the course name
       public void setCourseName( String name )
       {
          courseName = name; // store the course name
       } // end method setCourseName
    
       // method to retrieve the course name
       public String getCourseName()
       {
          return courseName;
       } // end method getCourseName
    
       // display a welcome message to the GradeBook user
       public void displayMessage()
       {
          // getCourseName gets the name of the course
          System.out.printf( "Welcome to the grade book for\n%s!\n\n",
             getCourseName() );
       } // end method displayMessage
    
       // determine class average based on 10 grades entered by user
       public void determineClassAverage()
       {
          // create Scanner to obtain input from command window
          Scanner input = new Scanner( System.in );
    
          int total; // sum of grades entered by user
          int gradeCounter; // number of the grade to be entered next
          int grade; // grade value entered by user
          int average; // average of grades
    
          // initialization phase
          total = 0; // initialize total
          gradeCounter = 1; // initialize loop counter
    
          // processing phase
          while ( gradeCounter <= 10 ) // loop 10 times
          {
             System.out.print( "Enter grade: " ); // prompt
             grade = input.nextInt(); // read grade from user
             total = total + grade; // add grade to total
             gradeCounter = gradeCounter + 1; // increment counter by 1
          } // end while
    
          // termination phase
          average = total / 10; // integer division yields integer result
    
          // display total and average of grades
          System.out.printf( "\nTotal of all 10 grades is %d\n", total );
          System.out.printf( "Class average is %d\n", average );
       } 
    
    }

  7.    Advertisement

Page 3 of 3 FirstFirst 123

Similar Threads

 
  1. Please help for JSON programming
    By globalweb in forum Programming
    Replies: 3
    Last Post: 02-08-2013, 11:21 AM
  2. Replies: 20
    Last Post: 02-10-2012, 11:30 PM
  3. help... JAVA basic programming!!
    By pakz in forum Programming
    Replies: 17
    Last Post: 09-28-2009, 03:10 PM
  4. Java Error... Please help!!!
    By happy_chique in forum Software & Games (Old)
    Replies: 3
    Last Post: 08-22-2008, 09:08 AM
  5. excel programs; needs help guys!!!
    By rufo in forum Software & Games (Old)
    Replies: 3
    Last Post: 01-14-2006, 12:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top