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 Help me find the correct programs answersplz 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
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 anyone can solve myplz 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
plz. answer my ques - Java Beginnersplz. 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
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
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 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
plz give me answer plzplz give me answer plz writw a programme to
find rank from an array using doubledimmensionalarray
plz helpplz 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 HelpPlz 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
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