Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: class name and grade

  1. #1
    Junior Member
    Join Date
    Mar 2014
    Posts
    26
    My Mood
    Inspired
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Default class name and grade

    this is my first programming course please take that into consideration please

    instructions:

    1. Add two private instance variables,
    String courseName and char grade to this class.

    2. Add accessor and mutator methods for these
    instance variables.

    3. Add a method register which receives an integer data type and returns String data type according to the argument passed to it (“Math” for 1, “English” for 2, “No course” for any other input)

    what i have so far:

    package assignment9;
     
    public class BannerUser 
    {
    	private int userId;
    	public int getUserId()  
    	{
    		return this.userId;
    	}
    	public void setUserId(int userId)  
    	{
    		this.userId=userId;
    	}
        private String courseName; 
        public String getcourseName()  
        {
        return this.courseName;
        }
        public void setcourseName(String courseName) 
        {
         this.courseName=courseName;
        }
        private char grade;
        public char getGrade()
        {
            return this.grade;
        }   
       String course;
        public String getCourse()
        {   
         if (course = 1)
         return "Math";
         else if(course = 2)
         return "English";
         else if (course != 1  !=2)
         return "No course";
        }
    }
    Last edited by ATB; April 6th, 2014 at 08:13 PM.


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,066
    My Mood
    Mellow
    Thanks
    184
    Thanked 652 Times in 639 Posts

    Default Re: class name and grade

    And what's your question?

Similar Threads

  1. translate grade
    By Rinor in forum What's Wrong With My Code?
    Replies: 3
    Last Post: March 12th, 2014, 01:46 PM
  2. Java Grade Caculator
    By egingras in forum What's Wrong With My Code?
    Replies: 1
    Last Post: December 5th, 2012, 05:37 AM
  3. How to display grade using graph?
    By Wai Wai in forum Java Theory & Questions
    Replies: 1
    Last Post: August 4th, 2012, 07:06 AM
  4. Grade Array Trouble
    By kite98765 in forum Collections and Generics
    Replies: 3
    Last Post: January 7th, 2010, 07:14 PM
  5. Help with JAVA (Grade Book)
    By Sara_21 in forum Java Theory & Questions
    Replies: 2
    Last Post: November 30th, 2009, 09:16 PM

Tags for this Thread