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;
  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();
    }
}









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
i want to find the byte code of a image file ... for my project..plz if anybody help me for java coding i will grateful..
i want to find the byte code of a image file ... for my project..plz if anybody help me for java coding i will grateful..   i want to convert... project.. but i cant convert Image file to its byte code format.. if anybody can plz
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 help me find a program
plz help me find a program  plz help..i want a source code in jsp for order processing
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
i cant find any compile time error but there is runtime error.
i cant find any compile time error but there is runtime error.  ...; Hi, Please check the field stud_code in database. In my case it is Text... check the thread JDBC ODBC error and the specified dsn contains an architecture
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
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
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
plz. answer my ques - Java Beginners
plz. answer my ques  I want to ask a prog. prob which would create... in which u want to do i mean for view or it simple console based.  create... with regards Fahid   i mean dont follow the first logic which
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 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
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
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
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
sir plz do respond to my problem immediately - Java Beginners
sir plz do respond to my problem immediately  Hello sir... for the progree bar is a separate program. sir i need to put it in my web browser.sir iam... code(sent by you).plz inject that code into my browser code so that it can show
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
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
How to find version of Java installed on my computer? - Java Beginners
How to find version of Java installed on my computer?  How to get... with many more new features.How to find version of Java installed on my computer?To find out the version of Java installed on your computer, just type Java
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
Need someone to check and modify my simple code - Java Beginners
Need someone to check and modify my simple code   How to write a class that contains Variables that hold hourly rate of pay, number of hours worked. Display gross pay, withholding tax, which is 15% and net pay. I have tried
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
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
check
updated"); will the above code check if the user has entered value for empcode
please check my code is wrong or ok.it was not work .this is form validation in javascript using jsf page
please check my code is wrong or ok.it was not work .this is form validation in javascript using jsf page  <p>?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN
plz plz plz inform me as soon as possible
plz plz plz inform me as soon as possible  ``by using c programs how to type
plz give me answer plz
plz give me answer plz  writw a programme to find rank from an array using doubledimmensionalarray
ModuleNotFoundError: No module named 'correct_pycountry'
ModuleNotFoundError: No module named 'correct_pycountry'  Hi, My... named 'correct_pycountry' error? Thanks   Hi, In your...: No module named 'correct_pycountry' error will be solved. Thanks
ModuleNotFoundError: No module named 'correct-horse'
ModuleNotFoundError: No module named 'correct-horse'  Hi, My... 'correct-horse' error? Thanks   Hi, In your python...;correct-horse' error will be solved. Thanks
ModuleNotFoundError: No module named 'correct-horse'
ModuleNotFoundError: No module named 'correct-horse'  Hi, My... 'correct-horse' error? Thanks   Hi, In your python...;correct-horse' error will be solved. Thanks
ModuleNotFoundError: No module named 'reynir-correct'
ModuleNotFoundError: No module named 'reynir-correct'  Hi, My... 'reynir-correct' error? Thanks   Hi, In your python... 'reynir-correct' error will be solved. Thanks
ModuleNotFoundError: No module named 'correct_pycountry'
ModuleNotFoundError: No module named 'correct_pycountry'  Hi, My... named 'correct_pycountry' error? Thanks   Hi, In your...: No module named 'correct_pycountry' error will be solved. Thanks
plz help
plz help  what is the procedure and code to design an interactive GUI in java using swings
ModuleNotFoundError: No module named 'plz'
ModuleNotFoundError: No module named 'plz'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'plz' How to remove the ModuleNotFoundError: No module named 'plz' error
ModuleNotFoundError: No module named 'plz'
ModuleNotFoundError: No module named 'plz'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'plz' How to remove the ModuleNotFoundError: No module named 'plz' error
Plz Help
Plz Help  Hello Guys!! Plz. Help I need to write a program to display the astrological sign based on your birthday for example If we enter the date of birth in the following format from console--13/08/1990 it should give you
plz plz rply as soon as possible
plz plz rply as soon as possible  by using c programs * * * * * s s s s s * s s o s s s s s s s s s s s s s s s s s s s s s s s
when I run exiting project that time I got error, I want solution on it?
when I run exiting project that time I got error, I want solution on it?  Error occurred during deployment: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start
cant call cmd from java - Java Beginners
cant call cmd from java   How can I call this from java to be executed by cmd ? ConvertXLS.EXE /S "C:\Extracto\*.CSV"/T "C:\Extracto\*.XLS" /C-4143 /F6 /M2 /R /V
I cant get values in MS acces in tables
I cant get values in MS acces in tables   I got problem in sending values from servlet . * i am using ms acces * i cant display my values but der is increase in number of rows my jsp: <%@ page language="java

Ads