The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
September 2000

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

how to solve problem

Posted by hemant kaddu on November 08, 2000 at 5:36 AM

Sir
I make programme to develope logic.I have create 4,5 class
and 1 class is main 2 class are subclass
PROBLEMS
1) SWITCH say Invalid choice
2) Construter can not work


/*
Genarel Infomation 1: Programme for Collage Admission
a) Enquiry Form
1) Enquiry no, 2) Name, 3) Address,
4) last Qualifiction Percentage,
5) Interested field (fields 1 to 9),
b) Enterance Exam
I) Enquiry no, II) a4
III)10 Quations,relating to a5
IV) Negative marks,
V) entrExamtol= a4+ III - IV if any
c) Classified
1) bII+bV>45 and < 60 a or b or c,
2) bII+bV>60 or <90 d or e or f,
3) bII+bV>90 g or h or i,
d) Conform Admission
1) Class Capacity(quta),
2) Roll no, 3) Waiting= a1 -c 1 to 3- d1
4) leaving student =d1 -d4 take from
Waiting (within 30 day)
e) uniExam
1) d3 = seatno, 2) compSub=4
3) opSub3(d2)
f) Certification
1) seat no 2) e2and e3 3)total (e2+e3)
g) Gread
1)<40 fail, 2)>60 c, 3)< 75 b,4)>80

programming Details2:- a)class b)inner class

*/
//=======================================================================
import java.io.*; //for DataInputStream
class EnquiryForm //a
{
int Enquiryno[] = {1,2,3,4,5,6,7,8,9};
String Name;
String Address;
Float lastQualifictionPercentage;
String Interestedfield[]= {"Hardware","Managemant","Maths",
"Networking","KM","Java",
"C++","Oracle","Prolog" };//(fields 1 to 9)
/*
The privevous Enquaries and its Number from last
befor Enterering New Enquiry form and the student
will Enter the Next Enquary No and his Details.
*/
void enquiryno()
{
for(int i=0;i {
System.out.println(" Enquiry no "+Enquiryno[i]);
}
try
{
DataInputStream in =new DataInputStream(System.in);
System.out.print(" Enter your Enquiries no ");
System.out.flush();
String EnquiryString =in.readLine();
int Enquiryno=Integer.parseInt(EnquiryString);
}
catch(IOException e)
{
System.out.println("I/O Error");
System.exit(1);
}
}
/*
student's Names ,Address , Last percentage
*/
void otherDetails()
{
try
{
DataInputStream in =new DataInputStream(System.in);
System.out.print(" Enter your Name ");
System.out.flush();
String Name =in.readLine();

System.out.print(" Enter your Address ");
System.out.flush();
String Address =in.readLine();

System.out.print(" Enter last percentage(B.com,B.Sc Diploma or Degree) " );
System.out.flush();
String lastQualiPerString =in.readLine();
lastQualifictionPercentage=Float.valueOf(lastQualiPerString);
}
catch(IOException e)
{
System.out.println("I/O Error");
System.exit(1);
}
}
/*
There are 9 options and student chooses 3 out of 9
*/
void interestedfield()
{
// ---------------
System.out.println("Your Choices are ");
for(int j=1;j {
System.out.print(j+" Your ");
System.out.println("choices is ? " + Interestedfield[j]);
}
System.out.print(" Enter No only [ 1 to 9 ] ");
System.out.println(" ");
try
{
DataInputStream in =new DataInputStream(System.in);
for(int i=1;i<4;i++)
{
System.out.print(i+" Enter your Choise ") ;
System.out.flush();
String Interestedfield =in.readLine();
}
}
catch(IOException e)
{
System.out.println("I/O Error");
System.exit(1);
}
try
{
DataInputStream in =new DataInputStream(System.in);
System.out.flush();
switch(Interestedfield.length)
{
case '1':
case 'a': System.out.println("Hardware:Interestedfield 1");
System.out.print("Hardware");
break;
case '2':
case 'b': System.out.println("Managemant:Interestedfield 2");
System.out.print("Mangemant");
break;
case '3':
case 'c': System.out.println("Maths");
System.out.print("Maths");
break;
case '4':
case 'd': System.out.println("Networking");
System.out.print("Networking");
break;
case '5':
case 'e': System.out.println("KM");
System.out.print("KM");
break;
case '6':
case 'f': System.out.println("Java");
System.out.print("Java");
break;
case '7':
case 'g': System.out.println("C++");
System.out.print("C++");
break;
case '8':
case 'h': System.out.println("Oracle");
System.out.print("Oracle");
break;
case '9':
case 'i': System.out.println("Prolog");
System.out.print("Prolog");
break;
default : System.out.println("Invalid Choice");
}
if(1==Interestedfield.length)
{
System.out.print("Hardware");
}
if(2==Interestedfield.length)
{
System.out.print("Mangemant");
}
if(3==Interestedfield.length)
{
System.out.print("Maths");
}
}
catch(Exception e)
{
System.out.println("I/O Error");
}
// ---------------
}
}
class EnteranceExam extends EnquiryForm //b
{
char Quations;
int Negativemarks;
int entrExamTol; //= III -(IV(if any))
void EnteranceExam(int Enquiryno[],String Name,String Address)
{
// super(Enquiryno[],Name,Address);
// Quations=x;
// Negativemarks=y;
// entrExamTol=z; //= III -(IV(if any))
}
void enteranceExam()
{

}
}
class Classified extends EnteranceExam //c
{
/*
1) bII+bV>60 a or b or c,
2) bII+bV<80 d or e or f,
3) bII+bV>90 g or h or i,
*/
char selection;// with a5
}
class ConformAdmission extends EnteranceExam //e
{
final static int ClassCapacity = 4;
// int ClassCapacity; //(quta),
int Rollno;
int Waiting; //= a1-c4-d1
}

class uniExam extends ConformAdmission //e
{
int seatno; //d3
int compSub4; //=4
int opSub3; //(d2)
}
class Certification extends uniExam //f
{
int seatno;
// e2 and e3
int total; //(e2+e3)
}
class Gread extends Certification //g
{
int gread;
// g2
// 1)<40 fail, 2)>60 c, 3) < 75 b, 4)>90 genous
}
class try2
{
public static void main(String args[])
{

EnquiryForm a =new EnquiryForm();
a.enquiryno();
a.otherDetails();
a.interestedfield();
// EnteranceExam b=new EnteranceExam();

}
}






Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us