Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
14 views

Advanced Server Side Programming Assesement 1

Uploaded by

Varshan Manish
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Advanced Server Side Programming Assesement 1

Uploaded by

Varshan Manish
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

ADVANCED SERVER SIDE PROGRAMMING CSI 3023 ASSESEMENT 1

NAME: VARSHAN MANISH


REGISTRATION: 22MIC0101
PROGRAM: MTECH INTEGRATED CSE
COURSE: ADVANCED SERVER SIDE PROGRAMMING (CSI 3023)
FACULTY: JUSTIN GOPINATH

SOURCE CODE:
import java.util.*;
public class Main{
public static void main(String args[]){
class GenderMismatchException extends Exception{};
class OverflowException extends Exception{};
class ExceedTeamSizeException extends Exception{};
class TeamNotFoundException extends Exception{};
class RTeam {
String name;
int count=-1;
String[] Parti=new String[5];
char[] sex=new char[5];
void registerRangoli(String name,char sex){
Parti[count]=name;
this.sex[count]=sex;
}
}
class GTeam{
String name;
int size;
void registerDance(String name,int size){
this.name=name;
this.size=size;
}
}
int ch=0,tcount=0,rcount=0,pcount,flag1=0,size=0,flag2=0;
String name;
char sex;
Scanner sci=new Scanner(System.in);
Scanner sct=new Scanner(System.in);
RTeam[] t=new RTeam[5];
GTeam[] g=new GTeam[5];
while(ch!=5){
if(flag1==1){
break;
}
System.out.println("1.Rangoli Event\n2.Group Dance Event\n3.Display
Teams\n4.Display Participants\n5.Exit");
ch=sci.nextInt();
if(ch==1){
if(tcount>=5){
System.out.println("Membership Limit Exceeded");
break;
}
t[tcount]=new RTeam();
System.out.println("Enter Team Name: ");
t[tcount].name=sct.next();
System.out.println("Enter Number Of Participants: ");
ADVANCED SERVER SIDE PROGRAMMING CSI 3023 ASSESEMENT 1

pcount=sci.nextInt();
if(pcount>5){
try {
throw new OverflowException();
} catch (OverflowException e) {
System.out.println("Team Membership Limit Exceeded (OverFlow
Exception)");
break;
}
}
else{
for(int i=0;i<pcount;i++){
System.out.println("Enter Participant Name: ");
name=sct.next();
System.out.println("Enter Participant Sex: ");
sex=sct.next().charAt(0);
if(sex!='F'){
try {
throw new GenderMismatchException();
} catch (GenderMismatchException e) {
System.out.println("Only Females Permitted
(GenderMismatchException)");
flag1=1;
break;
}
}
else{
System.out.println("Participant Admitted");
t[tcount].count++;
t[tcount].registerRangoli(name,sex);
}
}
tcount++;
}
}
else if(ch==2){
if(rcount>=5){
System.out.println("Membership Limit Exceeded");
break;
}
g[rcount]=new GTeam();
System.out.println("Enter Team Name: ");
name=sct.next();
System.out.println("Enter Team Size");
size=sci.nextInt();
if(size>4){
try {
throw new ExceedTeamSizeException();
} catch (ExceedTeamSizeException e) {
System.out.println("Team Member Limit Exceeded
(ExceedTeamSizeException)");
}
}
System.out.println("Team Details Admitted");
g[rcount].registerDance(name,size);
rcount++;
}
else if(ch==3){
flag2=0;
System.out.println("Enter Team Name: ");
name=sct.next();
for(int i=0;i<rcount;i++){
if(g[i].name.equals(name)){
System.out.println("Team Found");
ADVANCED SERVER SIDE PROGRAMMING CSI 3023 ASSESEMENT 1

flag2=1;
break;
}
}
if(flag2==0){
try {
throw new TeamNotFoundException();
} catch (TeamNotFoundException e) {
System.out.println("Team Not Found (TeamNotFoundException()");
}
System.out.println("Team Not Found");
}
}
else if(ch==4){
flag2=0;
System.out.println("Enter Team Name: ");
name=sct.next();
for(int i=0;i<tcount;i++){
if(t[i].name.equals(name)){
System.out.println("Participants: ");
for(String j:t[i].Parti){
System.out.println(j);
flag2=1;
}
break;
}
}
if(flag2==0){
System.out.println("Team Not Found");
}
}
if(ch==5){
break;
}
}
System.out.println("Thank You");
}
}

OUTPUT:
(EXCEPTION INTERRUPTED FLOW):
ADVANCED SERVER SIDE PROGRAMMING CSI 3023 ASSESEMENT 1
ADVANCED SERVER SIDE PROGRAMMING CSI 3023 ASSESEMENT 1
ADVANCED SERVER SIDE PROGRAMMING CSI 3023 ASSESEMENT 1

(NORMAL FLOW):
ADVANCED SERVER SIDE PROGRAMMING CSI 3023 ASSESEMENT 1
ADVANCED SERVER SIDE PROGRAMMING CSI 3023 ASSESEMENT 1
ADVANCED SERVER SIDE PROGRAMMING CSI 3023 ASSESEMENT 1

**************************************************************************

You might also like