CS508 Assignment No. 03
 Solution and Discussion


  • Cyberian's

    c9f3bcbb-65c5-4ba0-80c0-cc6a98cceaed-image.png
    Assignment No. 03
    Semester Spring 2019
    CS508- Modern Programming Languages

    Total Marks: 20

    Due Date: July 31, 2019
    Instructions
    Please 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.
    Uploading instructions
    Your submission must include:
    • Assignment should be in .rar format.
    • Save your assignment with your ID (e.g. bx180200786.rar).
    Objective
    The objective of this assignment is to give hands on practice on Java programming language.

    Lectures Covered: This assignment covers Lecture # 27 – 33
    Deadline
    Your assignment must be uploaded/submitted at or before July 31, 2019.

    Problem Statement:

    Make sure to write your id on top of the code file (As shown in the gif file) otherwise your assignment will not be accepted.
    Create a console application in java, where you will input a paragraph and also input some words and application will match all the words in the given paragraph to output success or failure for all words.

    1. First the paragraph will be inserted.
    2. Next the user will be asked to input words.
    3. Words will be inserted all at once without any space between the words, and words will be comma separated (example shown in the gif file).
    4. The application will check each word in the given paragraph and will output success or frailer for each word on a separate line checking must be case sensitive.
      You can install NetBeans IDE or simple java Compiler to develop application.

    Output.gif has been attached with this Assignment file please observe this file carefully your program’s output must be like this output file.
    Submission details
    output.gif
    Following 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.


  • Cyberian's

    CS508 Solution Idea # 3

    package main;
    
    import java.util.Scanner;
    
    public class Main {
    
    public static void main(String[] args) {
    
    System.out.println("My ID is bcxxxxxxxxx");
    System.out.println("Enter the Input Paragraph");
    Scanner s = new Scanner(System.in);
    String input = s.nextLine();
    
    System.out.println("Enter the Input Word");
    String word = s.nextLine();
    
    String str = "";
    int occurance = 0;
    for(char c : input.toCharArray()) {
    str += c;
    if(str.length() == word.length()) {
    if(str.equals(word)) {
    occurance ++;
    }
    
    str = str.substring(1);
    }
    }
    
    if(occurance > 0)
    System.out.println("The word is exist");
    else 
    System.out.println("The word is not exist");
    }
    }
    
    


  • CS 508 Idea Solutoin # 2
    CS506 Solution.gif



  • de564b29-034d-4813-94b7-5e9ac39ef847-image.png


Log in to reply
 

| |