We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Looking For Something at vustudents.ning.com? Click Here to Search

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More

Assignment No. 04 Semester: Fall 2013 Modern Programming Languages (CS508) Total Marks: 10 Due Date: 03/02/2014

You will write a simple JAVA program that will take input from user, After taking input in try block it will check it if it is your VU id. If it is your VU-ID it will display message “Yes it is my VU-ID” else it will raise an exception MyException, in catch block you will catch the myException.

 

Note you will not write anything in the catch block.

 

 

You will write a simple class MyException, this class will extend the exception class and it will display the message, You will write the method public MyException (), to

display the following message.

 

This is not my VU-ID

My VU-ID is bc123456789  (Note you will display your VU-ID here )

 

In case if you will write your correct VU-ID

 

 

 

Note :

 

1) In order to understand how to take input in java go through this tutorial

http://www.programmingsimplified.com/java/source-code/java-program-...

 

2) You will provide code and screenshot of your run to get full marks.

+ Click Here To Join also Our facebook study Group.

..How to Join Subject Study Groups & Get Helping Material?..


See Your Saved Posts Timeline

Views: 1500

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

Attachments:

Replies to This Discussion

AOA kaya is main just if else laga kay hum yah karain gay yah kuch or lagana hai humay is main samaj nhi ah rahie hai any one

I think

hum else part ma exception rasie kara ga or usa catch block ma handle kara ga

Thanks skyhigh

iss main custom exception create karni haa or phir test class main wrong id enter karna pa exception daga ka wrong id dali gai haa mean 2 classes bana gi iss case main

if else lga k exception throw krni hai aur catch block mai else lgana hai :p mai ne usi din kr li thi jis din asg ai thi

yup u r right

plz tell me java ka program kis software main likhna hai aur kasy compile aur run krna hai ager notepad main likhna hai to save kasy krna hai aur run ki command kasy likhni hai plz tell me

cs506 ka 3rd lacture main apko sab tarika mil jaye ga note pad likhna ha code or JDK install karna haa oor CMD main run hoga 

share ur code ............

cs508 solution 

import java.util.*;

public class MyException {

public static void main(String[] args)

{
String id;
Scanner in = new Scanner(System.in);

System.out.println("mari vu di id dass chawala");
id = in.nextLine();

if(id.equals("bc12345678"))
{
System.out.println("theak dasi ooh chawala ");

}
else{
System.out.println("ghalat jawab mari id "
/n+"bc12345678 waa chawala");

}
}

}

butt sb v fuuny 

miss asma if you are trying to say 

try

{

  if()
  {

}

catch()

{

   else{

   }

}

thn it is wrong even your code is running 

RSS

© 2019   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service