We have been working very hard since 2009 to facilitate in your learning Read More. We can't keep up without your support. Donate Now.

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

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

Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

How to Add New Discussion in Study Group ? Step By Step Guide Click Here.

CS508 Assignment No 03 Fall 2019 Solution & Discussion Due Date: 16-01-2020

    Assignment No. 03Semester Fall 2019CS508 - Modern Programming Languages Total Marks: 20
Due Date:16 January 2020    InstructionsPlease read the following instructions carefully before solving & submitting assignment:It should be clear that your assignment will 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 completely or partially copied from (other student, handouts or internet).Student ID is not mentioned in the assignment File or name of file is other than student ID.The assignment is not submitted in .rar format. 

 Submission detailsFollowing Files Must be submitted in a single .zip or .rar file.Code file(s) .java file only A .gif file which shows working of your Application (For Recording .gif a software named Screentogif is uploaded on LMS, or you can use any other gif recording tool as well)You are not required to submit the complete project, only copy these files from project folder. Please note if you submit doc or txt file you will be awarded 0 marks. Make sure to write your own VU ID in the assignment file(s) otherwise assignment will not be accepted.  If you do not submit any of the above mentioned file 50% marks per file will be deducted.ObjectiveThe objective of this assignment is to give hands on practice on Java programming language.
Lectures Covered: This assignment covers Lecture # 27 – 31    
Problem Statement:
You are required to create a multithreaded java console application which will read a text file and write processed output in another text file.The program will be able to read the text file provided named input.txt using a separate thread.Calculate the number of characters in the file as per your student id.Last number of your student id is the character your program will calculate from the given list below. Last Number in ID Character to calculate Last Number in ID Character to calculate    0 ! 5 &    1 @ 6 (    2 # 7 )    3 $ 8 _(Underscore)    4 % 9 =  Output the result on the screen.Create a new thread which will create an output file and store the result in that file.

Output.gif has been attached with this Assignment file please observe this file carefully your program’s output must be like this output file.  


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


Views: 1932

Attachments:

Replies to This Discussion

CS508 Assignment 3 Solution Fall 2019 | cs508 assignment 3 solution

CS508 Assignment 3 Solution Fall 2019. solution cs508 assignment 3. fall 2019 cs508 assignment 3 solution.

CS508 Solution Assignment No 03

Below link 

CS508_Assignmnet_03_Solution_Fall_2019_vustudents.ning.com.pdf

does anyone know how to do this assignment ?
please we all are already struggling with final year project. this is really tough.

ni bni to btyen kis tra ki help chaheay

Thread class

package bc160400;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;


public class Threads {
public static void main(String[] args) {
BlockingQueue<Integer> queue=new ArrayBlockingQueue<Integer>(1024);
ReaderThread reader=new ReaderThread(queue) {};
WriterThread writer=new WriterThread(queue);
System.out.println("My ID is BC1XXXXXX and special charactor to read is ')'");
new Thread(reader).start();
new Thread(writer).start();




// TODO code application logic here
}
}

ReaderThread class

package bc160400;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.concurrent.BlockingQueue;

/**
*
* @author Nasir
*/
public class ReaderThread implements Runnable {
protected BlockingQueue<Integer> blockingQueue;
public ReaderThread(BlockingQueue<Integer>blockingQueue){
this.blockingQueue=blockingQueue;

}
@Override
public void run(){
System.out.println("ReaderThread is started");
BufferedReader br=null;
try {
br=new BufferedReader(new FileReader(new File("inputFile.txt")));
int buffer=0;
char match=')';
while((buffer=br.read())!=-1){
if((char)buffer==match){
blockingQueue.put(buffer);

}
}
blockingQueue.put(0);
System.out.println("Read:Thread Ended");


} catch (FileNotFoundException e) {
e.printStackTrace();

}catch(IOException e){
e.printStackTrace();
}catch(InterruptedException e){
e.printStackTrace();
}finally{
try{
br.close();

}catch(IOException e){
e.printStackTrace();
}
}
}
}

WriterThread Class

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package bc160400;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.concurrent.BlockingQueue;

/**
*
* @author Nasir
*/
public class WriterThread implements Runnable{
protected BlockingQueue<Integer> blockingQueue;
public WriterThread(BlockingQueue<Integer>blockingQueue){
this.blockingQueue=blockingQueue;

}
@Override
public void run(){
System.out.println("WriterThread is started");
PrintWriter writer=null;
char match;
int no=0;
try {
writer =new PrintWriter(new File("outputFile.txt"));
while(true){
int buffer=blockingQueue.take();
match=(char)buffer;
no++;
if(buffer==(0)){
break;
}
writer.println(no);
System.out.println("'"+match+"'"+"Found So far:"+no);
}
System.out.println("WriterThread Ended");
System.out.println("Total Number of special Charactor:"+"')'"+"in the file are:"+(no-1));

} catch (FileNotFoundException e) {
e.printStackTrace();
}catch(InterruptedException e){

}finally{
writer.close();
}
}

}

Please change according to ur need against ur ID.

Pease run the file in netbean by defining project name. and make class of these class name.

Enjoy

netbean bhi downlaod ki jb open krta hn tou woh javase ka kehta hae

CS508 Assignment 3 Solution 16 January 2020

RSS

Latest Activity

+M.Tariq Malik replied to +M.Tariq Malik's discussion FIN611 GDB No 1 Fall 2020 Solution / Discussion in the group FIN611 Advanced Financial Accounting
2 minutes ago
+M.Tariq Malik liked +M.Tariq Malik's discussion FIN611 GDB No 1 Fall 2020 Solution / Discussion
2 minutes ago
+M.Tariq Malik replied to +M.Tariq Malik's discussion MTH100 Assignment 01 Fall 2020 Solution / Discussion in the group MTH100 General Mathematics
8 minutes ago
Hafiz faisal safder commented on +M.Tariq Malik's group MGT201 Financial Management
38 minutes ago
Neelam Javed replied to +M.Tariq Malik's discussion CS101 Assignment 01 Fall 2020 Solution / Discussion in the group CS101 Introduction to Computing
40 minutes ago
Profile IconNeelam Javed, Muhammad Fawad Hassan and 2 other members joined +M.Tariq Malik's group
40 minutes ago
Hafiz faisal safder commented on +M.Tariq Malik's group MGT611 Business & Labor Law
44 minutes ago
Hafiz faisal safder replied to Imtiaz Waqar's discussion MGT611 GDB No 01 Fall 2020 Solution / Discussion in the group MGT611 Business & Labor Law
55 minutes ago
+ " J i y a " ♥ posted discussions
1 hour ago
+M.Tariq Malik replied to +M.Tariq Malik's discussion CS301 Assignment No 01 Fall 2020 Solution & Discussion Due Date: 26-11-2020 in the group CS301 Data Structures
1 hour ago
+M.Tariq Malik replied to +M.Tariq Malik's discussion IT430 Assignment 01 Fall 2020 Solution / Discussion in the group IT430 E-Commerce
1 hour ago
+M.Tariq Malik liked +M.Tariq Malik's discussion IT430 Assignment 01 Fall 2020 Solution / Discussion
1 hour ago

Looking For Something? Search Here

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

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

.