Assignment-1 Final Code. Student.java
|
|
- Kristin Colleen Harrington
- 6 years ago
- Views:
Transcription
1 package com.ds.assgn1a; public class Student { public int rollno; public String name; public double marks; Assignment-1 Final Code Student.java public Student(int rollno, String name, double marks){ this.rollno = rollno; this.name = name; this.marks = public String tostring() { return "Student [rollno=" + rollno + ", name=" + name + ", marks=" + marks + "]"; Teacher.java
2 package com.ds.assgn1a; import java.util.arraylist; import java.util.enumeration; import java.util.scanner; import java.util.vector; public class Teacher { /*static Vector studentdb =new Vector();*/ static ArrayList<Student> studentdb = new ArrayList<Student>(); public static void main(string args[]) { Scanner sc = new Scanner(System.in); Operations obj = new Operations(); int rollno; Student s; while(true){ System.out.println(""); System.out.println(""); System.out.println(""); System.out.println("3. Search Student"); System.out.println(""); System.out.println(""); System.out.println(" "); int ch; ch = sc.nextint(); switch(ch){ case 1: s = obj.addstudent(); if(s!= null){ studentdb.add(s); System.out.println("Student added successfully!!!"); case 2:
3 System.out.println("Enter rollno to be deleted: "); rollno = sc.nextint(); boolean deleted = obj.deletestudent(rollno); if(deleted){ System.out.println("Roll no " + rollno + " deleted successfully!!!"); System.out.println("After Deletion updated list is - "); obj.display(studentdb); case 3: System.out.println("Enter rollno to be searched: "); rollno = sc.nextint(); s = obj.searchstudent(rollno); if(s == null){ System.out.println("Roll No " + rollno + " not found"); else{ System.out.println(s); case 4: System.out.println("Enter passing marks: "); double pm = sc.nextdouble(); /*Vector v = obj.failedstudents(pm);*/ ArrayList<Student> v= obj.failedstudents(pm); System.out.println("Failed Student's list -> "); obj.display(v);
4 if(ch == 5){ System.out.println("Bye Bye!!!"); sc.close(); class Operations{ void display(arraylist<student> v){ /*Enumeration e = v.elements(); while(e.hasmoreelements()){ System.out.println("" + (Student)e.nextElement()); */ for(student s : v) { System.out.println(s); Student addstudent(){ Scanner sc = new Scanner(System.in); System.out.println("RollNo: "); int rollno = sc.nextint(); System.out.println("Name: "); String name = sc.next(); System.out.println("Marks: "); double marks = sc.nextdouble();
5 Student obj = new Student(rollNo, name, marks); return obj; boolean deletestudent(int rollno){ /*Enumeration e = Teacher.studentDb.elements();*/ boolean status = false; for(student s :Teacher.studentDb) { if(s.rollno == rollno){ int index = Teacher.studentDb.indexOf(s); Teacher.studentDb.remove(index); status = true; /*while(e.hasmoreelements()){ Student s = (Student) e.nextelement(); if(s.rollno == rollno){ int index = Teacher.studentDb.indexOf(s); Teacher.studentDb.remove(index); status = true; */ return status; Student searchstudent(int rollno){ Student st = null; for (Student s: Teacher.studentDb) { if(s.rollno == rollno){ st=s;
6 /*Enumeration e = Teacher.studentDb.elements();*/ /*while(e.hasmoreelements()){ st = (Student) e.nextelement(); if(st.rollno == rollno){ */ return st; ArrayList<Student> failedstudents(double pm){ /*Vector v = new Vector();*/ ArrayList<Student> v = new ArrayList<Student>(); /*Enumeration e = Teacher.studentDb.elements(); while(e.hasmoreelements()){ Student st = (Student) e.nextelement(); if(st.marks < pm){ v.add(st); */ for(student s : Teacher.studentDb) { if(s.marks < pm){ v.add(s); return v;
7 //******************************************************** Output Running Steps:- 1. Run Teacher.java Code 3. Search Student 1 RollNo: 63 Name: dinesh Marks: 90 Student added successfully!!!
8 3. Search Student 1 RollNo: 20 Name: ddd Marks: 30 Student added successfully!!! 3. Search Student 1 RollNo:
9 11 Name: sss Marks: 95 Student added successfully!!! 3. Search Student 2 Enter rollno to be deleted: 11 Roll no 11 deleted successfully!!! After Deletion updated list is - Student [rollno=63, name=dinesh, marks=90.0] Student [rollno=20, name=ddd, marks=30.0]
10 3. Search Student 3 Enter rollno to be searched: 20 Student [rollno=20, name=ddd, marks=30.0] 3. Search Student 4 Enter passing marks: 40 Failed Student's list -> Student [rollno=20, name=ddd, marks=30.0]
11 3. Search Student 5 Bye Bye!!! /*
Assignment -3 Source Code. Student.java
import java.io.serializable; Assignment -3 Source Code Student.java public class Student implements Serializable{ public int rollno; public String name; public double marks; public Student(int rollno,
More informationAP COMPUTER SCIENCE A
AP COMPUTER SCIENCE A CONTROL FLOW Aug 28 2017 Week 2 http://apcs.cold.rocks 1 More operators! not!= not equals to % remainder! Goes ahead of boolean!= is used just like == % is used just like / http://apcs.cold.rocks
More informationCMPS 11 Introduction to Programming Midterm 1 Review Problems
CMPS 11 Introduction to Programming Midterm 1 Review Problems Note: The necessary material for some of these problems may not have been covered by end of class on Monday, the lecture before the exam. If
More informationimport org.simpleframework.xml.default; import org.simpleframework.xml.element; import org.simpleframework.xml.root;
C:/Users/dsteil/Documents/JavaSimpleXML/src/main/java/com/mycompany/consolecrudexample/Address.java / To change this template, choose Tools Templates and open the template in the editor. import org.simpleframework.xml.default;
More informationCCHS Math Recursion Worksheets M Heinen CS-A 12/5/2013. Recursion Worksheets Plus Page 1 of 6
CS-A // arraysol[][] = r; import java.util.scanner; public class RecursionApp { static int r; // return value static int[][] arraysol = new int[][7]; // create a solution array public static void main(string[]
More informationCSC 231 DYNAMIC PROGRAMMING HOMEWORK Find the optimal order, and its optimal cost, for evaluating the products A 1 A 2 A 3 A 4
CSC 231 DYNAMIC PROGRAMMING HOMEWORK 10-1 PROFESSOR GODFREY MUGANDA 1. Find the optimal order, and its optimal cost, for evaluating the products where A 1 A 2 A 3 A 4 A 1 is 10 4 A 2 is 4 5 A 3 is 5 20
More informationIntroduction to Computer Science Unit 2. Notes
Introduction to Computer Science Unit 2. Notes Name: Objectives: By the completion of this packet, students should be able to describe the difference between.java and.class files and the JVM. create and
More informationIntroduction to Computer Science Unit 2. Notes
Introduction to Computer Science Unit 2. Notes Name: Objectives: By the completion of this packet, students should be able to describe the difference between.java and.class files and the JVM. create and
More informationwhile (/* array size less than 1*/){ System.out.print("Number of students is invalid. Enter" + "number of students: "); /* read array size again */
import java.util.scanner; public class CourseManager1 { public static void main(string[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter number of students: "); /* read the number
More informationTiers (or layers) Separation of concerns
Tiers (or layers) Separation of concerns Hiding the type of storage from the client class Let s say we have a program that needs to fetch objects from a storage. Should the program have to be concerned
More informationFundamentals of Programming Data Types & Methods
Fundamentals of Programming Data Types & Methods By Budditha Hettige Overview Summary (Previous Lesson) Java Data types Default values Variables Input data from keyboard Display results Methods Operators
More informationStatic, Final & Memory Management
Static, Final & Memory Management The static keyword What if you want to have only one piece of storage regardless of how many objects are created or even no objects are created? What if you need a method
More informationOct Decision Structures cont d
Oct. 29 - Decision Structures cont d Programming Style and the if Statement Even though an if statement usually spans more than one line, it is really one statement. For instance, the following if statements
More informationExam 2. Programming I (CPCS 202) Instructor: M. G. Abbas Malik. Total Marks: 40 Obtained Marks:
كلية الحاسبات وتقنية المعلوما Exam 2 Programming I (CPCS 202) Instructor: M. G. Abbas Malik Date: November 22, 2015 Student Name: Student ID: Total Marks: 40 Obtained Marks: Instructions: Do not open this
More information2.2 - Making Decisions
2.2 - Making Decisions So far we have only made programs that execute the statements in order, starting with the statements at the top of the screen and moving down. However, you can write programs that
More informationSit-In Lab 2 - OOP Championship
Sit-In Lab 2 - OOP Championship Manage championships and perform these types of queries: Simulate one team wins in a championship Simulate a match with the result of draw in a championship Print the name
More informationArrays. Eng. Mohammed Abdualal
Islamic University of Gaza Faculty of Engineering Computer Engineering Department Computer Programming Lab (ECOM 2114) Created by Eng: Mohammed Alokshiya Modified by Eng: Mohammed Abdualal Lab 9 Arrays
More informationAssignment 8B SOLUTIONS
CSIS 10A Assignment 8B SOLUTIONS Read: Chapter 8 Choose and complete any 10 points from the problems below, which are all included in the download file on the website. Use BlueJ to complete the assignment,
More information1 Short Answer (15 Points Each)
COSC 7 Exam # Solutions Spring 08 Short Answer (5 Points Each). Write a method called RollCount that takes in two integer parameters rolls and target. The method should simulate the rolling of two die,
More informationWeek 14 Lab A Linked List of Integers Maximum Points = 10
Week 14 Lab A Linked List of Integers Maximum Points = 10 File IntList.java contains definitions for a linked list of integers. The class contains an inner class IntNode that holds information for a single
More informationCS 101 Spring 2007 Midterm 2 Name: ID:
You only need to write your name and e-mail ID on the first page. This exam is CLOSED text book, closed-notes, closed-calculator, closed-neighbor, etc. Questions are worth different amounts, so be sure
More informationObject Oriented Programming with JAVA
CIT 212 M Naveed Object Oriented Programming with JAVA LIST OF PRACTICALS 1. Installation of JDK 2. Installation of NetBean and Eclipse 3. Setup environment variable and Classpath 4. Program to Check Student
More informationAP CS Unit 3: Control Structures Notes
AP CS Unit 3: Control Structures Notes The if and if-else Statements. These statements are called control statements because they control whether a particular block of code is executed or not. Some texts
More informationQuestion 1 [20 points]
Question 1 [20 points] a) Write the following mathematical expression in Java. c=math.sqrt(math.pow(a,2)+math.pow(b,2)- 2*a*b*Math.cos(gamma)); b) Write the following Java expression in mathematical notation.
More informationH212 Introduction to Software Systems Honors
Introduction to Software Systems Honors Lecture #04: Fall 2015 1/20 Office hours Monday, Wednesday: 10:15 am to 12:00 noon Tuesday, Thursday: 2:00 to 3:45 pm Office: Lindley Hall, Room 401C 2/20 Printing
More informationMore Things We Can Do With It! Overview. Circle Calculations. πr 2. π = More operators and expression types More statements
More Things We Can Do With It! More operators and expression types More s 11 October 2007 Ariel Shamir 1 Overview Variables and declaration More operators and expressions String type and getting input
More informationObject Oriented Programming. Java-Lecture 6 - Arrays
Object Oriented Programming Java-Lecture 6 - Arrays Arrays Arrays are data structures consisting of related data items of the same type In Java arrays are objects -> they are considered reference types
More informationPROGRAM: import java.util.scanner;
1. import java.util.scanner; public class printname public static void main(string[] args) System.out.println("Input Your Name:"); String name = new Scanner(System.in).nextLine(); System.out.println("My
More informationSchool of Computer Science CPS109 Course Notes 5 Alexander Ferworn Updated Fall 15
Table of Contents 1 INTRODUCTION... 1 2 IF... 1 2.1 BOOLEAN EXPRESSIONS... 3 2.2 BLOCKS... 3 2.3 IF-ELSE... 4 2.4 NESTING... 5 3 SWITCH (SOMETIMES KNOWN AS CASE )... 6 3.1 A BIT ABOUT BREAK... 7 4 CONDITIONAL
More informationData dependent execution order data dependent control flow
Chapter 5 Data dependent execution order data dependent control flow The method of an object processes data using statements, e.g., for assignment of values to variables and for in- and output. The execution
More informationObject Oriented Programming
Object Oriented Programming Debapriyo Majumdar Programming and Data Structure Lab M Tech CS I Semester I Indian Statistical Institute Kolkata August 7 and 14, 2014 Objects Real world objects, or even people!
More informationArun chakravarthy Alagar samy. Technical Skill. Java Code Challenge - Basic Java
Arun chakravarthy Alagar samy E-MAIL arunchakkravarthy@gmail.com DATE OF LAST ACTIVITY 2017-11-27 TEST Java Code Challenge - Basic LANGUAGES USED Java Technical Skill CANDIDATE RESULT SKILL THRESHOLD Strongly
More informationSecond Exam Computer Programming 326 Dr. St. John Lehman College City University of New York Thursday, 11 November 2010
Second Exam Computer Programming 326 Dr. St. John Lehman College City University of New York Thursday, 11 November 2010 NAME (Printed) NAME (Signed) E-mail Exam Rules Show all your work. Your grade will
More informationCORE JAVA BASIC PROGRAMMING PROBLEMS FOR BEGINNERS PDF1. Learn all java programming concepts to crack java interviews and tests
CORE JAVA BASIC PROGRAMMING PROBLEMS FOR BEGINNERS PDF1 www.javalearnings.com Learn all java programming concepts to crack java interviews and tests //Java Program to Print Multiplication Table of a Given
More informationUniversity of Cape Town ~ Department of Computer Science. Computer Science 1015F ~ 2007
Name: Please fill in your Student Number and Name. Student Number : Student Number: University of Cape Town ~ Department of Computer Science Computer Science 1015F ~ 2007 Final Examination Question Max
More informationLab Exercise 1. Objectives: Part 1. Introduction
Objectives: king Saud University College of Computer &Information Science CSC111 Lab Object II All Sections - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
More informationCSIS 10A Assignment 9 Solutions
CSIS 10A Assignment 9 Solutions Read: Chapter 9 Choose and complete any 10 points from the problems below, which are all included in the download file on the website. Use BlueJ to complete the assignment,
More information/* Program that accepts a shopping list of five items from the command line and stores them in a vector */
/* Program that accepts a shopping list of five items from the command line and stores them in a vector */ import java.util.*; // load Vector class class ShoppingList public static void main(string args[
More informationMidterm Examination (MTA)
M105: Introduction to Programming with Java Midterm Examination (MTA) Spring 2013 / 2014 Question One: [6 marks] Choose the correct answer and write it on the external answer booklet. 1. Compilers and
More information1 Short Answer (10 Points Each)
1 Short Answer (10 Points Each) 1. Write a for loop that will calculate a factorial. Assume that the value n has been input by the user and have the loop create n! and store it in the variable fact. Recall
More information(A) 99 ** (B) 100 (C) 101 (D) 100 initial integers plus any additional integers required during program execution
Ch 5 Arrays Multiple Choice Test 01. An array is a ** (A) data structure with one, or more, elements of the same type. (B) data structure with LIFO access. (C) data structure, which allows transfer between
More informationFor that purpose, java provides control structures that serve to specify what has to be done by our program, when and under which circumstances.
Control Structures A program is usually not limited to a linear sequence of instructions. During its process it may bifurcate, repeat code or take decisions. For that purpose, java provides control structures
More informationHere is how we use an arraylist. To access the arraylist code we can import the class via:
ArrayLists, Generics A data structure is a software construct used to organize our data in a particular way. Some common data structures include lists, stacks, queues, and heaps. Dynamic data structures
More informationWeb-CAT submission URL: CAT.woa/wa/assignments/eclipse
King Saud University College of Computer & Information Science CSC111 Lab10 Arrays II All Sections ------------------------------------------------------------------- Instructions Web-CAT submission URL:
More informationBirkbeck (University of London) Software and Programming 1 In-class Test Mar 2018
Birkbeck (University of London) Software and Programming 1 In-class Test 2.1 22 Mar 2018 Student Name Student Number Answer ALL Questions 1. What output is produced when the following Java program fragment
More informationLinked Lists. private int num; // payload for the node private Node next; // pointer to the next node in the list }
Linked Lists Since a variable referencing an object just holds the address of the object in memory, we can link multiple objects together to form dynamic lists or other structures. In our case we will
More informationICSE Class 10 Computer Applications ( Java ) 2010 Solved Question...
1 of 12 05-11-2015 16:23 ICSE J Java for Class X Computer Applications ICSE Class 10 Computer Applications ( Java ) 2010 Solved Question Paper COMPUTER APPLICATIONS (Theory) Two Hours Answers to this Paper
More informationString. Other languages that implement strings as character arrays
1. length() 2. tostring() 3. charat() 4. getchars() 5. getbytes() 6. tochararray() 7. equals() 8. equalsignorecase() 9. regionmatches() 10. startswith() 11. endswith() 12. compareto() 13. indexof() 14.
More informationJAVA PROGRAMMING LAB. ABSTRACT In this Lab you will learn to define and invoke void and return java methods
Islamic University of Gaza Faculty of Engineering Computer Engineering Dept. Computer Programming Lab (ECOM 2114) ABSTRACT In this Lab you will learn to define and invoke void and return java methods JAVA
More informationCSE 8A Lecture 12. Reading for next class: : Sounds! Today s topics: Logical Operators:! && Start PSA 6: Chromakey!
CSE 8A Lecture 12 Reading for next class: 8.1-8.3: Sounds! Today s topics: Logical Operators:! && Start PSA 6: Chromakey! A vote for CSE 8A Yen Chuan (Allen) Liu and Pin (Arthur) Chu 1) Solo: (30 sec)
More informationCAT.woa/wa/assignments/eclipse
King Saud University College of Computer & Information Science CSC111 Lab10 Arrays II All Sections ------------------------------------------------------------------- Instructions Web-CAT submission URL:
More informationCOSC 123 Computer Creativity. I/O Streams and Exceptions. Dr. Ramon Lawrence University of British Columbia Okanagan
COSC 123 Computer Creativity I/O Streams and Exceptions Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Objectives Explain the purpose of exceptions. Examine the try-catch-finally
More informationLesson 10: Quiz #1 and Getting User Input (W03D2)
Lesson 10: Quiz #1 and Getting User Input (W03D2) Balboa High School Michael Ferraro September 1, 2015 1 / 13 Do Now: Prep GitHub Repo for PS #1 You ll need to submit the 5.2 solution on the paper form
More informationLiang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved
1 Thus far, you have used one-dimensional arrays to model linear collections of elements. You can use a two-dimensional array to represent a matrix or a table. For example, the following table that describes
More informationAN IMPROTANT COLLECTION OF JAVA IO RELATED PROGRAMS
JAVALEARNINGS.COM AN IMPROTANT COLLECTION OF JAVA IO RELATED PROGRAMS Visit for more pdf downloads and interview related questions JAVALEARNINGS.COM /* Write a program to write n number of student records
More informationControl Structures: if and while A C S L E C T U R E 4
Control Structures: if and while A C S - 1903 L E C T U R E 4 Control structures 3 constructs are essential building blocks for programs Sequences compound statement Decisions if, switch, conditional operator
More informationOOP++ CSE219, Computer Science III Stony Brook University
OOP++ CSE219, Computer Science III Stony Brook University http://www.cs.stonybrook.edu/~cse219 What is memory? A giant array of bytes 0xffffffff Stack Segment How do we assign data to/get data from memory?
More informationSupplementary Test 1
Name: Please fill in your Student Number and Name. Student Number : Student Number: University of Cape Town ~ Department of Computer Science Computer Science 1015F ~ 2009 Supplementary Test 1 Question
More informationFlexible data exchange with a method Parameters and return value
Chapter 9 Flexible data exchange with a method Parameters and return value A method provides flexibility as to where in the code its task is described to be performed: anywhere the method is called. Up
More informationProgram 20: //Design an Applet program to handle Mouse Events. import java.awt.*; import java.applet.*; import java.awt.event.*;
Program 20: //Design an Applet program to handle Mouse Events. import java.awt.*; import java.applet.*; import java.awt.event.*; /* */ public
More informationCS5000: Foundations of Programming. Mingon Kang, PhD Computer Science, Kennesaw State University
CS5000: Foundations of Programming Mingon Kang, PhD Computer Science, Kennesaw State University Arrays A data structure for a collection of data that is all of the same data type. The data type can be
More informationExample: Monte Carlo Simulation 1
Example: Monte Carlo Simulation 1 Write a program which conducts a Monte Carlo simulation to estimate π. 1 See https://en.wikipedia.org/wiki/monte_carlo_method. Zheng-Liang Lu Java Programming 133 / 149
More informationCS201 ArrayLists, Generics, and Dynamic Data Structures (Chapters 14, 15)
CS201 ArrayLists, Generics, and Dynamic Data Structures (Chapters 14, 15) A data structure is a software construct used to organize our data in a particular way. Some common data structures include lists,
More informationDistributed Systems Recitation 1. Tamim Jabban
15-440 Distributed Systems Recitation 1 Tamim Jabban Office Hours Office 1004 Tuesday: 9:30-11:59 AM Thursday: 10:30-11:59 AM Appointment: send an e-mail Open door policy Java: Object Oriented Programming
More informationCSC 1051 Villanova University. CSC 1051 Data Structures and Algorithms I. Course website:
Repetition CSC 1051 Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website: www.csc.villanova.edu/~map/1051/ Some slides in this
More information10/1/2018 Programming Data Structures. Quiz Exception Handling
10/1/2018 Programming Data Structures Quiz Exception Handling 1 Quiz 30 min 2 Quiz Answers 3 What we have learned... Array, 2-D arrays Base classes and derived classes Private, protected, default, and
More information(A) 99 (B) 100 (C) 101 (D) 100 initial integers plus any additional integers required during program execution
Ch 5 Arrays Multiple Choice 01. An array is a (A) (B) (C) (D) data structure with one, or more, elements of the same type. data structure with LIFO access. data structure, which allows transfer between
More information1. What is the difference between a compiler and an interpreter? Also, discuss Java s method.
Name: Write all of your responses on these exam pages. 1 Short Answer (5 Points Each) 1. What is the difference between a compiler and an interpreter? Also, discuss Java s method. 2. Java is a platform-independent
More informationBjarne Stroustrup. creator of C++
We Continue GEEN163 I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone. Bjarne Stroustrup creator
More informationBinghamton University. CS-140 Fall Problem Solving. Creating a class from scratch
Problem Solving Creating a class from scratch 1 Recipe for Writing a Class 1. Write the class boilerplate stuff 2. Declare Fields 3. Write Creator(s) 4. Write accessor methods 5. Write mutator methods
More informationFlow of Control. Chapter 3
Walter Savitch Frank M. Carrano Flow of Control Chapter 3 Outline The if-else statement The Type boolean The switch statement Flow of Control Flow of control is the order in which a program performs actions.
More informationPASS4TEST IT 인증시험덤프전문사이트
PASS4TEST IT 인증시험덤프전문사이트 http://www.pass4test.net 일년동안무료업데이트 Exam : 1z0-809 Title : Java SE 8 Programmer II Vendor : Oracle Version : DEMO Get Latest & Valid 1z0-809 Exam's Question and Answers 1 from
More informationDM550 / DM857 Introduction to Programming. Peter Schneider-Kamp
DM550 / DM857 Introduction to Programming Peter Schneider-Kamp petersk@imada.sdu.dk http://imada.sdu.dk/~petersk/dm550/ http://imada.sdu.dk/~petersk/dm857/ OBJECT-ORIENTED PROGRAMMING IN JAVA 2 Programming
More informationC12a: The Object Superclass and Selected Methods
CISC 3115 TY3 C12a: The Object Superclass and Selected Methods Hui Chen Department of Computer & Information Science CUNY Brooklyn College 10/4/2018 CUNY Brooklyn College 1 Outline The Object class and
More informationSoftware and Programming 1
Software and Programming 1 Week 9 Lab - Use of Classes and Inheritance 8th March 2018 SP1-Lab9-2018.ppt Tobi Brodie (Tobi@dcs.bbk.ac.uk) 1 Lab 9: Objectives Exercise 1 Student & StudentTest classes 1.
More informationCSC 1051 Data Structures and Algorithms I
Repetition CSC 1051 Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website: www.csc.villanova.edu/~map/1051/ Some slides in this
More information/ Download the Khateeb Classes App
Q) Write a program to read and display the information about a book using the following relationship. Solution: import java.io.*; class Author String name,nationality,s; InputStreamReader r = new InputStreamReader(System.in);
More informationCS 101 Exam 2 Spring Id Name
CS 101 Exam 2 Spring 2005 Email Id Name This exam is open text book and closed notes. Different questions have different points associated with them. Because your goal is to maximize your number of points,
More informationChapter 8 Multi-Dimensional Arrays
Chapter 8 Multi-Dimensional Arrays 1 1-Dimentional and 2-Dimentional Arrays In the previous chapter we used 1-dimensional arrays to model linear collections of elements. myarray: 6 4 1 9 7 3 2 8 Now think
More informationMIDTERM REVIEW. midterminformation.htm
MIDTERM REVIEW http://pages.cpsc.ucalgary.ca/~tamj/233/exams/ midterminformation.htm 1 REMINDER Midterm Time: 7:00pm - 8:15pm on Friday, Mar 1, 2013 Location: ST 148 Cover everything up to the last lecture
More informationChapter 9 Lab Text Processing and Wrapper Classes
Lab Objectives Chapter 9 Lab Text Processing and Wrapper Classes Use methods of the Character class and String class to process text Be able to use the StringTokenizer and StringBuffer classes Introduction
More informationControls Structure for Repetition
Controls Structure for Repetition So far we have looked at the if statement, a control structure that allows us to execute different pieces of code based on certain conditions. However, the true power
More informationObjektorienterad programmering
Objektorienterad programmering Lecture 8: dynamic lists, testing and error handling Dr. Alex Gerdes Dr. Carlo A. Furia SP1 2017/18 Chalmers University of Technology In the previous lecture 7 Reading and
More informationFlow of Control. Chapter 3
Flow of Control Chapter 3 Outline The if-else Stetement The Type boolean The switch statement Flow of Control Flow of control is the order in which a program performs actions. Up to this point, the order
More informationOver and Over Again GEEN163
Over and Over Again GEEN163 There is no harm in repeating a good thing. Plato Homework A programming assignment has been posted on Blackboard You have to convert three flowcharts into programs Upload the
More informationMore on Java. Object-Oriented Programming
More on Java Object-Oriented Programming Outline Instance variables vs. local variables Primitive vs. reference types Object references, object equality Objects' and variables' lifetime Parameters passing
More informationMenu Driven Systems. While loops, menus and the switch statement. Mairead Meagher Dr. Siobhán Drohan. Produced by:
Menu Driven Systems While loops, menus and the switch statement Produced by: Mairead Meagher Dr. Siobhán Drohan Department of Computing and Mathematics http://www.wit.ie/ Topics list while loops recap
More informationGive one example where you might wish to use a three dimensional array
CS 110: INTRODUCTION TO COMPUTER SCIENCE SAMPLE TEST 3 TIME ALLOWED: 60 MINUTES Student s Name: MAXIMUM MARK 100 NOTE: Unless otherwise stated, the questions are with reference to the Java Programming
More informationJump Statements. The keyword break and continue are often used in repetition structures to provide additional controls.
Jump Statements The keyword break and continue are often used in repetition structures to provide additional controls. break: the loop is terminated right after a break statement is executed. continue:
More informationBuilding Java Programs
Building Java Programs Chapter 5 Lecture 5-4: do/while loops, assertions reading: 5.1, 5.5 1 The do/while loop do/while loop: Performs its test at the end of each repetition. Guarantees that the loop's
More informationArray Lists. CSE 1310 Introduction to Computers and Programming University of Texas at Arlington. Last modified: 4/17/18
Array Lists CSE 1310 Introduction to Computers and Programming University of Texas at Arlington Last modified: 4/17/18 1 DEPARTAMENTAL FINAL EXAM Monday, DEC 10, 5:30pm-8pm rooms will be determined 2 Fixed
More informationSelec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Spring 2016 Howard Rosenthal
Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Spring 2016 Howard Rosenthal Lesson Goals Understand Control Structures Understand how to control the flow of a program
More informationPlease answer the following questions. Do not re-code the enclosed codes if you have already completed them.
Dec. 9 Loops Please answer the following questions. Do not re-code the enclosed codes if you have already completed them. What is a loop? What are the three loops in Java? What do control structures do?
More information1. [3 pts] What is your section number, the period your discussion meets, and the name of your discussion leader?
CIS 3022 Prog for CIS Majors I February 10, 2009 Exam I Print Your Name Your Section # Total Score Your work is to be done individually. The exam is worth 105 points (five points of extra credit are available
More informationCS141 Programming Assignment #5
CS141 Programming Assignment #5 Due Wednesday, Nov 16th. 1) Write a class that asks the user for the day number (0 to 6) and prints the day name (Saturday to Friday) using switch statement. Solution 1:
More informationExercise 1: Class Employee: public class Employee { private String firstname; private String lastname; private double monthlysalary;
Exercise 1: Class Employee: public class Employee { private String firstname; private String lastname; private double monthlysalary; public String getfirstname() { return firstname; public void setfirstname(string
More informationCS1020 Data Structures and Algorithms I Lecture Note #8. Exceptions Handling exceptional events
CS1020 Data Structures and Algorithms I Lecture Note #8 Exceptions Handling exceptional events Objectives Understand how to use the mechanism of exceptions to handle errors or exceptional events that occur
More information1) Consider the following code segment, applied to list, an ArrayList of Integer values.
Advanced Computer Science Unit 7 Review Part I: Multiple Choice (12 questions / 4 points each) 1) What is the difference between a regular instance field and a static instance field? 2) What is the difference
More informationJava Language Features
Java Language Features References: Object-Oriented Development Using Java, Xiaoping Jia Internet Course notes by E.Burris Computing Fundamentals with Java, by Rick Mercer Beginning Java Objects - From
More informationJump Statements. The keyword break and continue are often used in repetition structures to provide additional controls.
Jump Statements The keyword break and continue are often used in repetition structures to provide additional controls. break: the loop is terminated right after a break statement is executed. continue:
More information