Experiment No: Group B_4

Similar documents
ing execution. That way, new results can be computed each time the Class The Scanner

CS 251 Intermediate Programming Java I/O Streams

A+ Computer Science -

Reading Input from Text File

CSC 1214: Object-Oriented Programming

A+ Computer Science -

Lecture 11.1 I/O Streams

תוכנה 1 תרגול 8 קלט/פלט רובי בוים ומתי שמרת

Objec&ves. Review. Standard Error Streams

PIC 20A Streams and I/O

Character Stream : It provides a convenient means for handling input and output of characters.

Computational Expression

Darshan Institute of Engineering & Technology for Diploma Studies

Java Input/Output. 11 April 2013 OSU CSE 1

Object-Oriented Programming Design. Topic : Streams and Files

Simple Java Input/Output

Chapter 4 Java I/O. X i a n g Z h a n g j a v a c o s q q. c o m

Basic I/O - Stream. Java.io (stream based IO) Java.nio(Buffer and channel-based IO)

Software 1 with Java. Recitation No. 9 (Java IO) December 10,

Principles of Software Construction: Objects, Design and Concurrency. Design Case Study: Stream I/O. toad

Lecture 22. Java Input/Output (I/O) Streams. Dr. Martin O Connor CA166

File Input/Output. Introduction to Computer Science I. Overview (1): Overview (2): CSE 1020 Summer Bill Kapralos. Bill Kapralos.

Byte and Character Streams. Reading and Writing Console input and output

Software 1 with Java. Recitation No. 7 (Java IO) May 29,

Software 1. Java I/O

Software Practice 1 - File I/O

Files and IO, Streams. JAVA Standard Edition

Sri Vidya College of Engineering & Technology Question Bank

Programming Languages and Techniques (CIS120)

Data Conversion & Scanner Class

09-1. CSE 143 Java GREAT IDEAS IN COMPUTER SCIENCE. Overview. Data Representation. Representation of Primitive Java Types. Input and Output.

Computational Expression

File IO. Computer Science and Engineering College of Engineering The Ohio State University. Lecture 20

Lecture Set 2: Starting Java

Starting Out with Java: From Control Structures Through Objects Sixth Edition

Programming Languages and Techniques (CIS120)

Lecture Set 2: Starting Java

Using APIs. Chapter 3. Outline Fields Overall Layout. Java By Abstraction Chapter 3. Field Summary static double PI

Dining philosophers (cont)

Programming II (CS300)

Text User Interfaces. Keyboard IO plus

COMP 213. Advanced Object-oriented Programming. Lecture 19. Input/Output

C17: I/O Streams and File I/O

I/O streams. Byte Streams Character Streams InputStream ByteArrayInputStream FileInputStream FilterInputStream

File I/O Introduction to File I/O Text Files The File Class Binary Files 614

I/O in Java I/O streams vs. Reader/Writer. HW#3 due today Reading Assignment: Java tutorial on Basic I/O

Fundamentals of Programming Data Types & Methods

Java How to Program, 9/e. Copyright by Pearson Education, Inc. All Rights Reserved.

Programming Languages and Techniques (CIS120)

Project 1. Java Data types and input/output 1/17/2014. Primitive data types (2) Primitive data types in Java

Input. Scanner keyboard = new Scanner(System.in); String name;

Objec-ves JAR FILES. Jar files. Excep-ons. Files Streams. Ø Wrap up Ø Why Excep-ons? 9/30/16. Oct 3, 2016 Sprenkle - CSCI209 1

Week 12. Streams and File I/O. Overview of Streams and File I/O Text File I/O

1.00 Lecture 30. Sending information to a Java program

Input, Output and Exceptions. COMS W1007 Introduction to Computer Science. Christopher Conway 24 June 2003

Agenda & Reading. Python Vs Java. COMPSCI 230 S Software Construction

We now start exploring some key elements of the Java programming language and ways of performing I/O

ECE 122 Engineering Problem Solving with Java

Example: Copying the contents of a file

File Operations in Java. File handling in java enables to read data from and write data to files

I/O Streams. Object-oriented programming

Programming Languages and Techniques (CIS120)

Java Console Input/Output The Basics. CGS 3416 Spring 2018

Java Input / Output. CSE 413, Autumn 2002 Programming Languages.

Tirgul 1. Course Guidelines. Packages. Special requests. Inner classes. Inner classes - Example & Syntax

Lesson 02 Data Types and Statements. MIT 11053, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL

File I/O Array Basics For-each loop

Chapter 10. File I/O. Copyright 2016 Pearson Inc. All rights reserved.

Overview CSE 143. Input and Output. Streams. Other Possible Kinds of Stream Converters. Stream after Stream... CSE143 Wi

Using Java Classes Fall 2018 Margaret Reid-Miller

תוכנה 1 4 תרגול מס' שימוש במחלקות קיימות: קלט/פלט )IO(

CSCI 2010 Principles of Computer Science. Data and Expressions 08/09/2013 CSCI

COMP200 INPUT/OUTPUT. OOP using Java, based on slides by Shayan Javed

Basic Java IO Decorator pattern Advanced Java IO. Java IO - part 2 BIU OOP. BIU OOP Java IO - part 2

1/16/2013. Program Structure. Language Basics. Selection/Iteration Statements. Useful Java Classes. Text/File Input and Output.

Chapter 4 Classes in the Java Class Libraries

Peer Instruction 1. Elementary Programming

Any serious Java programmers should use the APIs to develop Java programs Best practices of using APIs

F1 A Java program. Ch 1 in PPIJ. Introduction to the course. The computer and its workings The algorithm concept

A token is a sequence of characters not including any whitespace.

CS18000: Programming I

Lecture Notes. System.out.println( Circle radius: + radius + area: + area); radius radius area area value

COMP 202. Built in Libraries and objects. CONTENTS: Introduction to objects Introduction to some basic Java libraries string

Algorithms. Produced by. Eamonn de Leastar

Core Java Contents. Duration: 25 Hours (1 Month)

Internet Technology 2/7/2013

Overview CSE 143. Data Representation GREAT IDEAS IN COMPUTER SCIENCE. Representation of Primitive Java Types. CSE143 Sp

IT101. File Input and Output

Objec&ves STANDARD ERROR. Standard Error Streams. Ø Byte Streams Ø Text Streams 10/5/16. Oct 5, 2016 Sprenkle - CSCI209 1

Overview CSE 143. Data Representation GREAT IDEAS IN COMPUTER SCIENCE. Representation of Primitive Java Types. CSE143 Au

Overview CSE 143. Data Representation GREAT IDEAS IN COMPUTER SCIENCE

Java Console Input/Output The Basics

Overview CSE 143. Data Representation GREAT IDEAS IN COMPUTER SCIENCE

Active Learning: Streams

Primitive Data Types: Intro

HST 952. Computing for Biomedical Scientists Lecture 8

File. Long term storage of large amounts of data Persistent data exists after termination of program Files stored on secondary storage devices

Full file at

PROGRAMACIÓN ORIENTADA A OBJETOS

Software 1 with Java. The java.io package. Streams. Streams. Streams. InputStreams

Transcription:

Experiment No: Group B_4 R (2) N (5) Oral (3) Total (10) Dated Sign Problem Definition: Write a web application using Scala/ Python/ Java /HTML5 to check the plagiarism in the given text paragraph written/ copied in the text box. Give software Modeling, Design, UML and Test cases for the same using COMET (Concurrent Object Oriented Modeling and Architectural Design Method).. 1.1 Learning Objective: 1 Understand the Meaning of Software modeling using COMET. 2 Implement the logic for Check the Plagiarism in the given text. 1.2 Theory: 1.2.1 Introduction Java Scanner class To Check the Plagiarism in the given text first of all perform string compare operation also need to understand the operation related to scanner classes. There are various ways to read input from the keyboard, the java.util.scanner class is one of them. The Java Scanner class breaks the input into tokens using a delimiter that is whitespace bydefault. It provides many methods to read and parse various primitive values. Java Scanner class is widely used to parse text for string and primitive types using regular expression. Java Scanner class extends Object class and implements Iterator and Closeable interfaces.

There is a list of commonly used Scanner class methods: Method public String next() public String nextline() public byte nextbyte() Description it returns the next token from the scanner. it moves the scanner position to the next line and returns the value as a string. it scans the next token as a byte. public short nextshort() it scans the next token as a short value. public int nextint() public long nextlong() public float nextfloat() it scans the next token as an int value. it scans the next token as a long value. it scans the next token as a float value. public nextdouble() double it scans the next token as a double value. java.io.printstream class: The PrintStream class provides methods to write data to another stream. The PrintStream class automatically flushes the data so there is no need to call flush() method. Moreover, its methods don't throw IOException. Stream A stream is a sequence of data.in Java a stream is composed of bytes. It's called a stream because it's like a stream of water that continues to flow. In java, 3 streams are created for us automatically. All these streams are attached with console. 1) System.out: standard output stream 2) System.in: standard input stream

3) System.err: standard error stream Let's see the code to print output and error message to the console. 1. System.out.println("simple message"); 2. System.err.println("error message"); OutputStream Java application uses an output stream to write data to a destination, it may be a file,an array,peripheral device or socket. InputStream Java application uses an input stream to read data from a source, it may be a file,an array,peripheral device or socket. Output Stream class OutputStream class is an abstract class.it is the superclass of all classes representing an output stream of bytes. An output stream accepts output bytes and sends them to some sink. Reading data from keyboard There are many ways to read data from the keyboard. For example: InputStreamReader

Console Scanner DataInputStream etc. InputStreamReader class InputStreamReader class can be used to read data from keyboard.it performs two tasks: connects to input stream of keyboard converts the byte-oriented stream into character-oriented stream Java Console class The Java Console class is be used to get input from console. It provides methods to read text and password. If you read password using Console class, it will not be displayed to the user. The java.io.console class is attached with system console internally. The Console class is introduced since 1.5. Let's see a simple example to read text from console. 1. String text=system.console().readline(); 2. System.out.println("Text is: "+text); FileInputStream and FileOutputStream (File Handling) In Java, FileInputStream and FileOutputStream classes are used to read and write data in file. In another words, they are used for file handling in java. Java FileOutputStream class Java FileOutputStream is an output stream for writing data to a file. Java String compare To

The java string compareto() method compares the given string with current string lexicographically. It returns positive number, negative number or 0. If first string is greater than second string, it returns positive number (difference of character value). If first string is less than second string, it returns negative number and if first string is equal to second string, it returns 0. 1. s1 > s2 => positive number 2. s1 < s2 => negative number 3. s1 == s2 => 0 COMET COMET is a highly iterative object-oriented software development method that addresses the requirements, analysis, and design modeling phases of the object-oriented development life cycle. The functional requirements of the system are defined in terms of actors and use cases. Each use case defines a sequence of interactions between one or more actors and the system. A use case can be viewed at various levels of detail. In a requirements model, the functional requirements of the system are defined in terms of actors and use cases. In an analysis model, the use case is realized to describe the objects that participate in the use case, and their interactions. In the design model, 1.3 Assignment Question? 1. What do you know about the Scanner Classes? 2. What is Stream and how to create Stream automatically? 3. How to read the data from the keyboard? 4. What do you know about java console class? 5. What is COMET?