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

Visual Programming (CS411) Assignment # 2 (GRADED) ......... Deadline Date = 10/12/2015

Visual Programming (CS411)

Assignment # 2 (GRADED)

Total marks = 20

                                                                                       Deadline Date = 10/12/2015

Please carefully read the following instructions before attempting the assignment.

Rules for Marking

It should be clear that your assignment would not get any credit if:

  • The assignment is submitted after due date.
  • The submitted assignment does not open or file is corrupt.
  • The assignment is copied. Note that strict action would be taken if the submitted assignment is copied from any other student. Both students will be punished severely.

 

1)      You should consult recommended books to clarify your concepts as handouts are not sufficient.

2)      You are supposed to submit your complete solution project as a single file (i. e. zip or RAR). Any other formats like scan images, PDF, bmp, docx etc. will not be accepted.

3)      You are advised to upload your assignment at least two days before Due date.

 

Important Note:

Assignment comprises of 20 Marks. Note that no assignment will be accepted after due date via email in any case (whether it is the case of load shedding or emergency electric failure or internet malfunctioning etc.). Hence, refrain from uploading assignment in the last hour of the deadline, and try to upload Solutions at least 02 days before the deadline to avoid inconvenience later on.

For any query please contact: CS411@vu.edu.pk

Question:

You are required to implement a Simple Salary Reader System (SSRS). The name and salary of different people is given in the attached XML file. Write a console based application with following requirements:

Program will take name of a person as input. It will then read the XML file to search the said person. If person is found, its salary will be read from the file and displayed on console as shown in output window given below. However, if person is not found, system will display “Person not found” message.

To Read XMLSalaries file from the project folder, you can use following statement:

string Dir = System.IO.Path.GetFullPath(@"..\..\..\");

The above statement will return the path of your project folder (the folder containing XMLSalaries.xml file). So, in above case “Dir” variable will contain “E:\\SalaryReader\\”. Now you can append name of the file (i.e. XMLSalaries.xml) with “Dir” variable and read it.

+ How to Follow the New Added Discussions at Your Mail Address?

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

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?


See Your Saved Posts Timeline

Views: 6068

.

+ 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?)

+ Click Here To Join (Our facebook study Group)

Attachments:

Replies to This Discussion

start discussion plzz
kasy bnani h

Attachments:

bro your name irfan farid

Done :)

hello sheriq (R) jb b mera msg dekho mujhe reply kro. as fast as you can... am noor fatima your campus mate... fb ya ning pe contct kro....

code to uplode kr do

Dear Friends,

It is a very easy assignment. I have submitted my assignment.  Here is an idea for you

 

  • Get XML file from reader
  • Get input from user
  • Use while loop
  • While (xmlreader.Read())
  • In while loop get the attributes from XML file
  • Use IF condition to compare the user input name and the name you get from GetAttribute
  • Get the salary if the match found using GetAttribute and print it on screen
  • Set a flag for match found or not and use it outside of while loop to print message "Oops ! no person  . . . . . . ."

For further help see handouts page # 48 -49

I hope it will be helpful for you.

string Dir = System.IO.Path.GetFullPath(@"..\..\..\"); iska kya karna ha bhai

done

Share Some Code

koi to code uplode kr da  

i am facing problem in the code, By code working 90% fine, It reads the file and print the name with salary the way as required, but it also prints the Oops message with it.

With Correct Name

With Wrong Name

My Code So far is

static void Main(string[] args)
{
string personName = "";
Console.Write("Enter Name of Person: ");
personName = Console.ReadLine();
string DIR = Path.GetFullPath(@"Some_Path_To\XMLSalaries.xml");
XmlReader reader = XmlReader.Create(DIR);
while (reader.Read())
{
if ((reader.NodeType == XmlNodeType.Element) && (reader.Name == "Salary"))
{
if (reader.GetAttribute("Name") == personName && reader.HasAttributes)
{
if (reader.HasAttributes)
{
Console.WriteLine("Salary of " + personName + " = " + reader.GetAttribute("CurrentSalary"));
}
}
}
}
Console.WriteLine("Oops! no person with the name \"" + personName + "\" was found.");
Console.ReadKey();
}

RSS

Latest Activity

+ ! ! ! AA g❤️ ! ! ! + liked +"Certified Gangster"++'s discussion For all female friends
3 minutes ago
+ ! ! ! AA g❤️ ! ! ! + replied to + ! ! ! AA g❤️ ! ! ! +'s discussion ++!!!!!!!EARTH QUACKS!!!!!!!!!!++
5 minutes ago
+"Certified Gangster"++ liked + ! ! RebeL's discussion Read this out Loud !!!!!!!!!
5 minutes ago
+ ! ! ! AA g❤️ ! ! ! + replied to +"Certified Gangster"++'s discussion For all female friends
6 minutes ago
+"Certified Gangster"++ replied to +"Certified Gangster"++'s discussion For all female friends
8 minutes ago
+"Certified Gangster"++ replied to +"Certified Gangster"++'s discussion For all female friends
8 minutes ago
+"Certified Gangster"++ replied to +"Certified Gangster"++'s discussion For all female friends
9 minutes ago
ASIM MAQSOOD posted a discussion
26 minutes ago
♦_"Tooba"_♦ replied to + "αяsαℓ " Ќąƶµяɨ •"'s discussion 2019 Noble Prize Winners
46 minutes ago
+ ! ! RebeL updated their profile
47 minutes ago
♦_"Tooba"_♦ liked + "αяsαℓ " Ќąƶµяɨ •"'s discussion 2019 Noble Prize Winners
48 minutes ago
+ "αяsαℓ " Ќąƶµяɨ •" replied to + "αяsαℓ " Ќąƶµяɨ •"'s discussion Muhabato me li gaye kasmain
1 hour ago
+ "αяsαℓ " Ќąƶµяɨ •" replied to + "αяsαℓ " Ќąƶµяɨ •"'s discussion Muhabato me li gaye kasmain
1 hour ago
+ "αяsαℓ " Ќąƶµяɨ •" replied to + ! ! ! AA g❤️ ! ! ! +'s discussion ++!!!!!!!EARTH QUACKS!!!!!!!!!!++
1 hour ago
彡JK彡 ❤️ replied to 彡JK彡 ❤️'s discussion Dedicated To All Fake IDs............ :p:p
1 hour ago
♦_"Tooba"_♦ commented on ♦_"Tooba"_♦'s status
1 hour ago
+ ! ❤INNOCENT❤ replied to + ! ❤INNOCENT❤'s discussion Akhri Salam Smjh kr
1 hour ago
+ ! ❤INNOCENT❤ replied to + ! ❤INNOCENT❤'s discussion Akhri Salam Smjh kr
1 hour ago
ϝ ι ყ α replied to + "αяsαℓ " Ќąƶµяɨ •"'s discussion Muhabato me li gaye kasmain
1 hour ago
Nouman Butt replied to ♦_"Tooba"_♦'s discussion Guzri Howi Zindagi Ko Kabhi Yaad Na Kr
1 hour ago

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

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