plz check my codings are correct or not...There is an error..i cant find it..

Ads
 

plz check my codings are correct or not...There is an error..i cant find it..

import java.util.Scanner;
public class Student
{
  private String indexNo;
  private String gender;
  private char initial;
  private int mark1;
  private int mark2;
  private int mark3;
  private int max;

  public Student(String newIndexNo, String newGender, char newInitial, int newMark1, int newMark2, int newMark3)

    {
        indexNo=newIndexNo;
            gender=newGender;
        initial=newInitial;
        mark1=newMark1;
        mark2=newMark2;
        mark3=newMark3;
    }

  public void setIndex(String newIndex)
    {
        indexNo=newIndex;
    }

  public void setGender(String newGender)
    {
        gender=newGender;
    }

  public void setInitial(char newInitial)
    {
        if(newInitial != 'f' || newInitial != 'm')
        initial='m';
    }

  public void setMark1(int newMark1)
    {
        if(newMark1<0 || newMark1>100)
        mark1=0;
    }

  public void setMark2(int newMark2)
    {
        if(newMark2<0 || newMark2>100)
        mark2=0;
    }

  public void setMark3(int newMark3)
    {
        if(newMark3<0 || newMark3>100)
        mark3=0;
    }

  public String getIndex()
    {
        return indexNo;
    }

  public String getGender()
    {
        return gender;
    }

  public char getInitial()
    {
        return initial;
    }

  public int getMark1()
    {
        return mark1;
    }

  public int getMark2()
    {
        return mark2;
    }

  public int getMark3()
    {
        return mark3;
    }




  public void read()
    {
        Scanner text= new Scanner(System.in);
        Scanner num=new Scanner(System.in);

        System.out.print("Enter your index No: ");
        indexNo=text.nextLine();
        System.out.print("Enter your Gender: ");
        gender=text.nextLine();
        initial=gender.charAt(0);
        System.out.print("Enter your mark 1: ");
        mark1=num.nextInt();
        System.out.print("Enter your mark 2: ");
        mark2=num.nextInt();
        System.out.print("Enter your mark 3: ");
        mark3=num.nextInt();
    }

  public void maxMarks()
    {

    if(mark1>mark2 && mark1>mark3)
            max=mark1;
    else
        if(mark2>mark1 && mark2>mark3)
            max=mark2;   
    else
            max=mark3;  

    }


  public void display()
    {
        System.out.printf("%s %c %d %d %d",indexNo,initial,mark1,mark2,mark3);
        System.out.print("          ");
        System.out.printf("Index No %s,You earned %d",indexNo,max);
    }

}//end of class


import java.lang.String;
public class StudentTest
{
  public static void main(String args[])
    {
    Student stu = new Student("AS2010461",'f',"AS2010461",80);
    stu.getIndex();
    stu.getGender();
    stu.getInitial();
    stu.getMark1();
    stu.getMark2();
    stu.getMark3();
    stu.read();
    stu.maxMarks();
    stu.display();
    }
}


import java.util.Scanner;
public class Results
 {
    Scanner kbd=new Scanner(System.in);

    int maxMarks;

        StudentTest stu1=new StudentTest();

        if (maxMarks>90)
            System.out.print("Excellent");
        else if (maxMarks<50)
            System.out.print("Try again");
        else if (maxMarks<=90 && initial='f')
            System.out.print("Good girl");
        else
            System.out.print("Good boy");

public void display1()
      {
        System.out.printf("%s %c %d %d %d",indexNo,initial,mark1,mark2,mark3);
    System.out.print("          ");
    System.out.printf("Index No %s,You earned %d",indexNo,max);
      }
}
View Answers

March 8, 2011 at 5:21 PM

Do modifications in StudentTest.java:

import java.lang.String;
public class StudentTest
{
  public static void main(String args[])
    {
    Student stu = new Student("AS2010461","AS2010461",'f',80,90,100);
    stu.getIndex();
    stu.getGender();
    stu.getInitial();
    stu.getMark1();
    stu.getMark2();
    stu.getMark3();
    stu.read();
    stu.maxMarks();
    stu.display();
    }
}

Ads









Related Tutorials/Questions & Answers:
plz check my codings are correct or not...There is an error..i cant find it..
plz check my codings are correct or not...There is an error..i cant find it..  import java.util.Scanner; public class Student { private String indexNo; private String gender; private char initial; private int mark1
plz Help me find the correct programs answers
plz Help me find the correct programs answers   Create a washing...; subtract Create a class called Student which has the following methods: i... INDICA" and "TATA NANO" respectively. Plz mail me your answers
Advertisements
Is this correct???what are the unnessasary codings here??
Is this correct???what are the unnessasary codings here??  import java.util.Scanner; public class Length { public int meters; public int centiMeters; public double yards; public double feet; public double inches
plz help me find a program
plz help me find a program  plz help..i want a source code in jsp for order processing
plz solve my query?
plz solve my query?  how to remove all the options from select control in html using java script?   JavaScript remove all items <...) { var i; for(i=selectbox.options.length-1;i>=0;i--) { selectbox.remove(i
Plz Provide correct program code for all questions.
Plz Provide correct program code for all questions.   Write a program to find the difference between sum of the squares and the square of the sums...: "); int n=input.nextInt(); for(int i=1;i<=n;i++){ int
this is my code but i cant able to run it wt is the problem
this is my code but i cant able to run it wt is the problem  import java.io.*; class createthread { int thread=4,i; class thread1 extends createthread { public void run() { for(i=0;i
this is my code but i cant able to run it wt is the problem
this is my code but i cant able to run it wt is the problem  import java.io.*; class createthread { int thread=4,i; class thread1 extends createthread { public void run() { for(i=0;i
plz anyone can solve my
plz anyone can solve my  creat an applet prog which accepts the details of 10 customers like name , address , city , ect. and display it   import java.awt.*; import javax.swing.*; import java.awt.event.*; import
I didn't gat an output for this code, plz send me a correct code
I didn't gat an output for this code, plz send me a correct code  Hi, Here is my code: import java.awt.event.*; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import javax.swing.*; import java.sql.*; public
Is the logic correct to detect IE version..plz let me know
Is the logic correct to detect IE version..plz let me know  <html> <head> <script type="text/javascript"> function checkIEVersion() { var IE_Version; var IE_Engine; /*@cc_on @if( @_jscript_version
Probblems with printing if my innput of text file is correct..
Probblems with printing if my innput of text file is correct..  I am trying to make sure this block of code does what I think it will do. Can someone show me with some code how I can print out what is is labled with <----print
ModuleNotFoundError: No module named 'find-my-favorite-cat'
: No module named 'find-my-favorite-cat' error? Thanks   Hi..., ModuleNotFoundError: No module named 'find-my-favorite-cat' error...ModuleNotFoundError: No module named 'find-my-favorite-cat'  Hi
ModuleNotFoundError: No module named 'find-my-favorite-cat'
: No module named 'find-my-favorite-cat' error? Thanks   Hi..., ModuleNotFoundError: No module named 'find-my-favorite-cat' error...ModuleNotFoundError: No module named 'find-my-favorite-cat'  Hi
ModuleNotFoundError: No module named 'find-my-favorite-cat'
: No module named 'find-my-favorite-cat' error? Thanks   Hi..., ModuleNotFoundError: No module named 'find-my-favorite-cat' error...ModuleNotFoundError: No module named 'find-my-favorite-cat'  Hi
How to find latitude and longitude of my Mobile Phone?
How to find latitude and longitude of my Mobile Phone?  Hi, What is the best method to find the latitude and longitude of my current location in my... then you can use any GPS enabled application to find the current latitude
How can I find my DHCP IP address on my computer?
How can I find my DHCP IP address on my computer?  Hi, I am using Ubuntu and I trying to find the IP address assigned to my computer by DHCP server. How to find the IP address? Thanks   Hi, You can try following
ModuleNotFoundError: No module named 'cant'
ModuleNotFoundError: No module named 'cant'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'cant' How to remove the ModuleNotFoundError: No module named 'cant' error
plz try to clear my doubt for shuffling multi-dimensional array
plz try to clear my doubt for shuffling multi-dimensional array  hi...??? plz help me... thanks in advance   Hi Friend, Try the following code... ShuffleMultiDimensionalArray() { for (int i = 0; i < size*size; i++){ list.add(i
plz give me program to this: Given a string and a number ‘n’, find the ‘n’th distinct repeating character.
plz give me program to this: Given a string and a number ?n?, find the ?n?th distinct repeating character.    Given a string and a number ?n?, find the ?n?th distinct repeating character. For example, Input: Abracadabra, 1
fetch database value to text box based on selected value my code given below pls correct my code
fetch database value to text box based on selected value my code given below pls correct my code  my Code Given below Pls... help me send correct code for me jsp file... <%@page contentType="text/html" pageEncoding
fetch database value to text box based on selected value my code given below pls correct my code
fetch database value to text box based on selected value my code given below pls correct my code  my Code Given below Pls... help me send correct code for me jsp file... <%@page contentType="text/html" pageEncoding
how can i add wirecard option(or button ) at my web page plz tell all steps? View Answers
how can i add wirecard option(or button ) at my web page plz tell all steps? View Answers  how can i add wirecard option(or button ) at my web page plz tell all steps? View Answers
ModuleNotFoundError: No module named 'cant-touch-this'
ModuleNotFoundError: No module named 'cant-touch-this'  Hi, My... 'cant-touch-this' error? Thanks   Hi, In your python... named 'cant-touch-this' error will be solved. Thanks
**Connectivity is not getting done in this program plz check it out wat is the problem with that Although i've made tables in MA-ACCESS**
**Connectivity is not getting done in this program plz check it out wat is the problem with that Although i've made tables in MA-ACCESS**  <p>import java.io.*; import java.awt.*; import java.awt.event.*; import
plz give me answer plz
plz give me answer plz  writw a programme to find rank from an array using doubledimmensionalarray
why cant i close this ??
why cant i close this ??  import java.util.Scanner; public class square { public static void main ( String [] args) { Scanner keyboard...("Thank you "); } } i should use while to get the square of the number entered
one error but i dont know how to fix it o_O!!!
one error but i dont know how to fix it o_O!!!  where is the mistake here ?? import java.utill.Scanner; public class Time { public static void..."); } } the compilar told me that there is only one error... thx
find the first character is vowel or not
find the first character is vowel or not  hi friend, can u plz send me javascript code for find the wether the first character is a vowel or not. 2) check wether the last character is same as the first character or not 3) check
check
updated"); will the above code check if the user has entered value for empcode
plz help
plz help  what is the procedure and code to design an interactive GUI in java using swings

Ads