CSC142, Computer Science II, Project 5 (2 nd submission)
|
|
- Hortense Leonard
- 6 years ago
- Views:
Transcription
1 CSC142, Computer Science II, Project 5 (2 nd submission) Due via D2L. Late programs are not acceptable. Evaluation: Your score is given only when the program follows the given template and can fully support the required results. a. Write a class ArrayOperation with an array that is initiated with a sequence of integers in its constructor. The program of constructor will check with the user how many numbers are needed and then store them in a private attribute (private int [ ] data). The class should also have the following methods (instance): gettotal(), which should return total of the values in the array data. getaverage(), which should return the average of the values in the array data. gethighest(), which should return the highest value in the array data. getlowest(), which should return the lowest value in the array data. Accessor (tostring) and mutator (setdata) of such an array data, so that the entire array can be return and any element of such an array can be updated. Then write another class ArrayOperations with the only static main method. In that main method, implement a test case that can cover all the above methods (constructor, accessor, mutator, and other 4 methods). For instance: Scanner kb = new Scanner(System.in); System.out.println("Before the test, build your array object for? integers!"); System.out.print("Input the number of integers:"); int ArrayOperation a = new ArrayOperation(index); String str = ""; kb.nextline(); // to consume the end of line for the above print, not println System.out.println("Do you want to start the test, Y/N or y/n?"); while((str.touppercase()).charat(0)=='y'){ System.out.println("1: what are in the array now?"); System.out.println("2: change the value of an element."); System.out.println("3: total of the array values."); System.out.println("4: average of the array values."); System.out.println("5: highest of the array values."); System.out.println("6: lowest of the array values."); System.out.println("other number: quit!"); int event = kb.nextint(); switch(event){ case 1: // accessor of data case 2:
2 System.out.print("Please key-in the position:"); System.out.print("Please key-in the new value:"); int value = kb.nextint(); // the value inputed can be out of range! a.setdata(index, value); // mutator System.out.print("After the change:"); case 3: System.out.println("Total of the values is: "+(a.gettotal())); case 4: System.out.println("Average of the values is: "+a.getaverage()); case 5: System.out.println("Highest of the values is: "+a.gethighest()); case 6: System.out.println("Lowest of the values is: "+a.getlowest()); if(event < 1 event >6 ) str = "N"; else{ System.out.println("Do you want to continue the test, Y/N or y/n?"); kb.nextline(); //consume the print-out information for the below reading b. Write a class Account with a method that accepts a charge account as its argument. The method should determine whether the argument number is valid by comparing it to the following list of valid charge account numbers: , , , , , , , , , , , , , , , , , These numbers should be stored in an array that is initiated in the class as a private attribute. If the number is in the array, the method should return true, otherwise, return false. Then write another class AccountApplication with the only static main method. In that main method, implement a test of such a method by asking the user to enter a charge account number. The program should display a message indicating whether the number is valid or invalid. c. Write a class DirverExam that has a private array of char initiated to hold the correct answers of the local driver s license exam: 1. B, 2. D, 3. A, 4. A, 5. C, 6. A, 7. B, 8. A, 9. C, 10. D, 11. B, 12. C, 13. D, 14. A, 15. D, 16. C, 17. C, 18. B, 19. D, 20. A The class must have another private array to save the student s answers. The class should have the constructor to allow this student to input all answers (by nextline().touppercase().charat(0)). This class also should have the following methods (public):
3 Passed ( ), returns true if the student passed the exam, or false if the student failed. The exam has 20 multiple questions. A student must correctly answer 15 of the 20 questions to pass the exam. totalcorrect ( ), returns the total number of correctly answered questions. totalincorrect ( ), returns the total number of incorrectly answered questions. questionsmissed ( ), returns an array of integers that contains the numbers of the questions that the student missed. Note that in the student score array, any character other than A, B, C, or D will be treated as an answer missed. Then write a class DL with the only static main method. In that main method, implement a test case that can test all the above methods. For instance: public static void main(string[] args) { DriversExam d = new DriversExam(); System.out.println("Has this student passed the test? "+d.passed()); System.out.println("# of questions correctly answered: "+ ; d. Write a class Payroll that uses the following arrays as fields (private): employeeid, an array of 7 integers to hold employee ID. The array should be initialized with the following numbers: , , , , , , hours, an array of 7 integers to hold the number of hours worked by each employee. payrate, an array of 7 doubles to hold each employee s hourly pay rate. wages, an array of 7 doubles to hold each employee s gross wages. This class should have all accessors and mutators of these fields (on each array element). Assume the data in each array is related through the subscript. For example, the number in element 0 of the hours array should be the number of hours worked by the employee whose ID number is stored in element 0 of the employeeid array. That same employee s pay rate should be stored in element 0 of the payrate array. Your class should also have a method that accepts an employee s ID as an argument and returns the gross pay for that employee. Then write a class AccountApplication with the only static main method. In that main method, implement a test case that can cover all the above accessors and mutators. Note that negative values for hours or numbers less than 6.00 for pay rate are not accepted. For instance: Payroll a = new Payroll(); Scanner kb = new Scanner(System.in); a.setall(); System.out.println("Do you want to start the test, Y/N or y/n?"); String while((str.touppercase()).charat(0)=='y'){ System.out.println("1: Dispaly the whole table."); System.out.println("2: Reset the whole table."); System.out.println("3: Dispaly the record of a person with index."); System.out.println("4: Dispaly the record of a person with his/her ID.");
4 System.out.println("5: Update any individual record."); System.out.println("other number: quit!"); int event = kb.nextint(); int index, id; switch(event){ case 1: case 2: a.setall(); case 3: System.out.println("Input Index please:"); System.out.println("Hours:"+a.getHours(index)); System.out.println("PayRate:"+a.getPayRate(index)); case 4: System.out.println("Input employee ID please:"); id = kb.nextint(); index=a.getindex(id); if(index!=-1){ System.out.println("Hours:"+a.getHours(index)); System.out.println("PayRate:"+a.getPayRate(index)); else System.out.println("Either not found or out of range."); case 5: index=-1; System.out.println("1. Update hours with index."); System.out.println("2. Update hours with employee ID."); System.out.println("3. Update payrate with index."); System.out.println("4. Update payrate with employee ID."); System.out.println("Other number. Back to Main menu."); event = kb.nextint(); while(event>=1&&event <=4){ if(event==1 event ==3){ System.out.println("Input Index please:"); else if (event ==2 event==4){ System.out.println("Input ID please:"); id = kb.nextint(); index=a.getindex(id);
5 else index = -1; if(index!=-1){ if(event==1)a.sethours(index); else a.setpayrate(index); a.setwages(index); System.out.println(); else System.out.println("Either not found or out of range!"); System.out.println("1. Update hours with index."); System.out.println("2. Update hours with employee ID."); System.out.println("3. Update payrate with index."); System.out.println("4. Update payrate with employee ID."); System.out.println("Other number. Back to Main menu."); event = kb.nextint(); if(event < 1 event >5 ) str = "N"; else{ System.out.println("Do you want to continue the test, Y/N or y/n?"); kb.nextline(); //consume the print-out information for the below reading e. Write a class GradeBook that uses the following arrays as private fields: names, a string array to hold five students names grades, an array of 5 characters to hold the five students letter grades. testscores, a 2-dimentional array to hold 4 test scores for each of five students. The class should have a constructor for the user to enter each student s name and his or her four test scores. The constructor will use an associate method (private double getavg(int index)) to obtain the average test score for student index, and then convert to a letter grade into grades[index] by the other (private void setgrade). This method will use the following Numeric-To-Letter-Grade Scale: A, B, C, D, 0-59 F. The accessor (public String tostring) will return a string that carries all private information needed to access. Then write a class Grade with the only static main method. In that main method, implement a test case that can cover all the above accessor. Note that any score less than 0 or greater 100 is not acceptable. When constructor is executed in the object initialization, the program will allow the user to enter each student s name and his or her four test scores. After that, the program should display each student s name, average score, and letter grade.
Practice Problems: Object & instance methods
Practice Problems: Object & instance methods 1. Tracing programs a. What gets printed to the screen when we execute the MysteryClient class on the left? public class MysteryClient public static void main(
More informationPractice Problems: Instance methods
Practice Problems: Instance methods Submit your java files to D2L. Late work will not be acceptable. a. Write a class Person with a constructor that accepts a name and an age as its argument. These values
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 informationCSC141, Computer Science I, Instructor: Dr. Zhen Jiang, Test 2
CSC141, Computer Science I, Instructor: Dr. Zhen Jiang, Test 2 Name(print) Student Number Page Points Score 2 8 3 8 4 8 5 6 6 8 7 8 8 10 9 6 10 6 11 11 12 21 Total 100 1 Part 1 (56 pts): Select the correct
More informationFinal Exam Practice. Partial credit will be awarded.
Please note that this problem set is intended for practice, and does not fully represent the entire scope covered in the final exam, neither the range of the types of problems that may be included in the
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 informationArrays and the TOPICS CHAPTER 8. CONCEPT: An array can hold multiple values of the same data type simultaneously.
CHAPTER 8 Arrays and the ArrayList Class TOPICS 8.1 Introduction to Arrays 8.2 Processing Array Elements 8.3 Passing Arrays As Arguments to Methods 8.4 Some Useful Array Algorithms and Operations 8.5 Returning
More information1 Short Answer (5 Points Each)
1 Short Answer (5 Points Each) 1. Write a declaration of an array of 300 strings. String strarray[] = new String[300];. Write a method that takes in an integer n as a parameter and returns one half of
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 informationJava Classes: Math, Integer A C S L E C T U R E 8
Java Classes: Math, Integer A C S - 1903 L E C T U R E 8 Math class Math class is a utility class You cannot create an instance of Math All references to constants and methods will use the prefix Math.
More informationInstance Method Development Demo
Instance Method Development Demo Write a class Person with a constructor that accepts a name and an age as its argument. These values should be stored in the private attributes name and age. Then, write
More information1 Short Answer (7 Points Each)
1 Short Answer ( Points Each) 1. Write a linear search method for an integer array that takes in an array and target value as parameters and returns the first position of the target in the array. If the
More informationSelection Statements and operators
Selection Statements and operators 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/
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 informationMULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.
CSIS 10A PRACTICE FINAL EXAM SOLUTIONS Closed Book Closed Computer 3 Sheets of Notes Allowed MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) What
More information1 Short Answer (5 Points Each)
1 Short Answer (5 Points Each) 1. What are the three types of programming errors? Briefly describe each of them. Syntax Error: An error in the program code due to misuse of the programming language. Run-time
More informationFall CS 101: Test 2 Name UVA ID. Grading. Page 1 / 4. Page3 / 20. Page 4 / 13. Page 5 / 10. Page 6 / 26. Page 7 / 17.
Grading Page 1 / 4 Page3 / 20 Page 4 / 13 Page 5 / 10 Page 6 / 26 Page 7 / 17 Page 8 / 10 Total / 100 1. (4 points) What is your course section? CS 101 CS 101E Pledged Page 1 of 8 Pledged The following
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 informationThis exam is open book. Each question is worth 3 points.
This exam is open book. Each question is worth 3 points. Page 1 / 15 Page 2 / 15 Page 3 / 12 Page 4 / 18 Page 5 / 15 Page 6 / 9 Page 7 / 12 Page 8 / 6 Total / 100 (maximum is 102) 1. Are you in CS101 or
More informationFirst Exam Computer Programming 326 Dr. St. John Lehman College City University of New York Thursday, 7 October 2010
First Exam Computer Programming 326 Dr. St. John Lehman College City University of New York Thursday, 7 October 2010 NAME (Printed) NAME (Signed) E-mail Exam Rules Show all your work. Your grade will be
More informationCS1083 Week 2: Arrays, ArrayList
CS1083 Week 2: Arrays, ArrayList mostly review David Bremner 2018-01-08 Arrays (1D) Declaring and using 2D Arrays 2D Array Example ArrayList and Generics Multiple references to an array d o u b l e prices
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 informationCSIS 10A Practice Final Exam Solutions
CSIS 10A Practice Final Exam Solutions 1) (5 points) What would be the output when the following code block executes? int a=3, b=8, c=2; if (a < b && b < c) b = b + 2; if ( b > 5 a < 3) a = a 1; if ( c!=
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 informationSelection Statements and operators
Selection Statements and operators 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/
More information1 Short Answer (10 Points Each)
1 Short Answer (10 Points Each) 1. For the following one-dimensional array, show the final array state after each pass of the three sorting algorithms. That is, after each iteration of the outside loop
More informationEvaluating the Style of your programs
Evaluating the Style of your programs Objectives At the end of this exercise, students will: Roles Be able to evaluate a program for conformance to style guide for the class. Be able to evaluate arithmetic
More informationHandout 4 Conditionals. Boolean Expressions.
Handout 4 cs180 - Programming Fundamentals Fall 17 Page 1 of 8 Handout 4 Conditionals. Boolean Expressions. Example Problem. Write a program that will calculate and print bills for the city power company.
More information1 Short Answer (10 Points Each)
Name: Write all of your responses on these exam pages. 1 Short Answer (10 Points Each) 1. What is the difference between a compiler and an interpreter? Also, discuss how Java accomplishes this task. 2.
More informationMaximization and Minimization Problems. CSE 1310 Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington
Maximization and Minimization Problems CSE 1310 Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1 Maximization Problems Given a set of data, we want to find
More informationIntroduction to Computer Programming
Introduction to Computer Programming Lecture 2- Primitive Data and Stepwise Refinement Data Types Type - A category or set of data values. Constrains the operations that can be performed on data Many languages
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 informationCourse Outline. Introduction to java
Course Outline 1. Introduction to OO programming 2. Language Basics Syntax and Semantics 3. Algorithms, stepwise refinements. 4. Quiz/Assignment ( 5. Repetitions (for loops) 6. Writing simple classes 7.
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 informationFaculty of Science COMP-202B - Introduction to Computing I (Winter 2009) Midterm Examination
First Name: Last Name: McGill ID: Section: Faculty of Science COMP-202B - Introduction to Computing I (Winter 2009) Midterm Examination Monday, March 9, 2009 Examiners: Mathieu Petitpas [Section 1] 18:30
More informationProject#1: Grade Book
Project#1: Grade Book Objective Making Classes and Objects from these Classes. Also, practice making an array of objects and manipulating/using the data inside said array. Program Description This program
More informationFull file at
Chapter 1 1. a. False; b. False; c. True; d. False; e. False; f; True; g. True; h. False; i. False; j. True; k. False; l. True. 2. Keyboard and mouse. 3. Monitor and printer. 4. Because programs and data
More informationConditional Execution
Unit 3, Part 3 Conditional Execution Computer Science S-111 Harvard University David G. Sullivan, Ph.D. Review: Simple Conditional Execution in Java if () { else {
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 informationCS 101 Fall 2006 Midterm 3 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 information1 Short Answer (5 Points Each)
1 Short Answer (5 Points Each) 1. What are the three types of programming errors? Briefly describe each of them. Syntax Error: An error in the program code due to misuse of the programming language. Run-time
More informationChapter 4 Defining Classes I
Chapter 4 Defining Classes I This chapter introduces the idea that students can create their own classes and therefore their own objects. Introduced is the idea of methods and instance variables as the
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 informationANSWER KEY First Exam Computer Programming 326 Dr. St. John Lehman College City University of New York Thursday, 7 October 2010
ANSWER KEY First Exam Computer Programming 326 Dr. St. John Lehman College City University of New York Thursday, 7 October 2010 1. True or False: (a) T An algorithm is a a set of directions for solving
More informationCSIS 10A PRACTICE FINAL EXAM Name Closed Book Closed Computer 3 Sheets of Notes Allowed
CSIS 10A PRACTICE FINAL EXAM Name Closed Book Closed Computer 3 Sheets of Notes Allowed MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) What would
More informationJava Classes: Random, Character A C S L E C T U R E 6
Java Classes: Random, Character A C S - 1903 L E C T U R E 6 Random An instance of the Random can be used to generate a stream of random values Typical process: 1. Create a Random object 2. Use the object
More informationProblem Grade Total
CS 101, Prof. Loftin: Final Exam, May 11, 2009 Name: All your work should be done on the pages provided. Scratch paper is available, but you should present everything which is to be graded on the pages
More informationCSC 1051 Algorithms and Data Structures I. Final Examination May 2, Name:
CSC 1051 Algorithms and Data Structures I Final Examination May 2, 2015 Name: Question Value 1 10 Score 2 10 3 10 4 10 5 10 6 10 7 10 8 10 9 20 TOTAL 100 Please answer questions in the spaces provided.
More informationAssignment 1 due Monday at 11:59pm
Assignment 1 due Monday at 11:59pm The heart of Object-Oriented Programming (Now it gets interesting!) Reading for next lecture is Ch. 7 Focus on 7.1, 7.2, and 7.6 Read the rest of Ch. 7 for class after
More information1. Which of the following is the correct expression of character 4? a. 4 b. "4" c. '\0004' d. '4'
Practice questions: 1. Which of the following is the correct expression of character 4? a. 4 b. "4" c. '\0004' d. '4' 2. Will System.out.println((char)4) display 4? a. Yes b. No 3. The expression "Java
More informationif (x == 0); System.out.println( x=0 ); if (x = 0) System.out.println( x=0 );
Sample Final Exam 1. Evaluate each of the following expressions and show the result and data type of each: Expression Value Data Type 14 % 5 1 / 2 + 1 / 3 + 1 / 4 4.0 / 2.0 Math.pow(2.0, 3.0) (double)(2
More informationObjects as a programming concept
Objects as a programming concept IB Computer Science Content developed by Dartford Grammar School Computer Science Department HL Topics 1-7, D1-4 1: System design 2: Computer Organisation 3: Networks 4:
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 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 informationSpring 2017 CMSC 140 Programming Project 7: Payroll
Spring 2017 CMSC 140 Programming Project 7: Payroll Concepts tested by the program: 1. Working with arrays 2. Using file operations 3. Using a selection sort to sort parallel arrays 4. Using a binary search
More informationQuestion: Total Points: Score:
CS 170 Exam 1 Section 000 Spring 2014 Name (print):. Instructions Keep your eyes on your own paper and do your best to prevent anyone else from seeing your work. Do NOT communicate with anyone other than
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 informationNotes on Chapter Three
Notes on Chapter Three Methods 1. A Method is a named block of code that can be executed by using the method name. When the code in the method has completed it will return to the place it was called 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 informationTutorial 12. Exercise 1: Exercise 2: CSC111 Computer Programming I
College of Computer and Information Sciences CSC111 Computer Programming I Exercise 1: Tutorial 12 Arrays: A. Write a method add that receives an array of integers arr, the number of the elements in the
More informationCSC 240 Computer Science III Spring 2018 Midterm Exam. Name
CSC 240 Computer Science III Spring 2018 Midterm Exam Name Page Points Score 2 9 4-6 53 7-10 38 Total 100 1 P age 1. Tracing programs (1 point each value): For each snippet of Java code on the left, write
More informationPage 1 / 3. Page 2 / 18. Page 3 / 8. Page 4 / 21. Page 5 / 15. Page 6 / 20. Page 7 / 15. Total / 100. Pledge:
This pledged 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, we recommend that you do not
More informationArrays. Here is the generic syntax for an array declaration: type[] <var_name>; Here's an example: int[] numbers;
Arrays What are they? An array is a data structure that holds a number of related variables. Thus, an array has a size which is the number of variables it can store. All of these variables must be of the
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 information1 Short Answer (5 Points Each)
1 Short Answer (5 Points Each) 1. What are the three types of programming errors? Briefly describe each of them. Syntax Error: An error in the program code due to misuse of the programming language. Run-time
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 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 informationHappy Cinco de Mayo!!!!
CSC 1051 Algorithms and Data Structures I Happy Cinco de Mayo!!!! Final Examination May 5, 2018 Name: Question Value Score 1 10 2 10 3 10 4 10 5 10 6 10 7 10 8 10 9 20 TOTAL 100 Please answer questions
More informationTutorial 6 CSC 201. Java Programming Concepts مبادئ الربجمة باستخدام اجلافا
Tutorial 6 CSC 201 Java Programming Concepts مبادئ الربجمة باستخدام اجلافا Chapter 6: Classes and Objects 1. Classes & Objects What is an object? Real Objects Java Objects Classes Defining a class and
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 informationPractice problem on defining and using Class types. Part 4.
CS180 Programming Fundamentals Practice problem on defining and using Class types. Part 4. Implementing object associations: Applications typically consist of collections of objects of different related
More informationSelec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Fall 2016 Howard Rosenthal
Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Fall 2016 Howard Rosenthal Lesson Goals Understand Control Structures Understand how to control the flow of a program
More informationQuestion: Total Points: Score:
CS 170 Exam 1 Section 000 Fall 2014 Name (print): Instructions: Keep your eyes on your own paper and do your best to prevent anyone else from seeing your work. Do NOT communicate with anyone other than
More informationLecture 6. Assignments. Summary - Variables. Summary Program Parts 1/29/18. Reading: 3.1, 3.2, 3.3, 3.4
Assignments Lecture 6 Complete for Project 1 Reading: 3.1, 3.2, 3.3, 3.4 Summary Program Parts Summary - Variables Class Header (class name matches the file name prefix) Class Body Because this is a program,
More informationChapter 10. Further Abstraction Techniques
Chapter 10 Further Abstraction Techniques In the previous chapter, we saw how Java checks the usage of methods. We also saw that if the method is not defined in the superclass, the compiler will not work.
More informationHappy Cinco de Mayo!!!!
CSC 1051 Algorithms and Data Structures I Happy Cinco de Mayo!!!! Final Examination May 5, 2018 Name: KEY Question Value Score 1 10 2 10 3 10 4 10 5 10 6 10 7 10 8 10 9 20 TOTAL 100 Please answer questions
More informationQuestion: Total Points: Score:
CS 170 Exam 1 Section 000 Spring 2015 Name (print): Instructions: Keep your eyes on your own paper and do your best to prevent anyone else from seeing your work. Do NOT communicate with anyone other than
More informationObject Oriented Programming. Java-Lecture 1
Object Oriented Programming Java-Lecture 1 Standard output System.out is known as the standard output object Methods to display text onto the standard output System.out.print prints text onto the screen
More informationQuestion 1. Part (a) Simple Syntax [1 mark] Circle add_ints(), because it is missing arguments to the function call. Part (b) Simple Syntax [1 mark]
Note to Students: This file contains sample solutions to the term test together with the marking scheme and comments for each question. Please read the solutions and the marking schemes and comments carefully.
More informationMcGill University School of Computer Science COMP-202A Introduction to Computing 1
McGill University School of Computer Science COMP-202A Introduction to Computing 1 Midterm Exam Thursday, October 26, 2006, 18:00-20:00 (6:00 8:00 PM) Instructors: Mathieu Petitpas, Shah Asaduzzaman, Sherif
More informationQuestion: Total Points: Score:
CS 170 Exam 1 Section 001 Fall 2014 Name (print): Instructions: Keep your eyes on your own paper and do your best to prevent anyone else from seeing your work. Do NOT communicate with anyone other than
More informationCSIS-120 Final Exam Fall 2015 Name:
1. Which line of code creates a Player object called player1 using the default constructor a) Player player1; b) Player player1 = new Player (); c) Player1 Player(); d) Player player1 = new Player ; e)
More informationM105: Introduction to Programming with Java Midterm Examination (MTA) Makeup Spring 2013 / 2014
M105: Introduction to Programming with Java Midterm Examination (MTA) Makeup Spring 2013 / 2014 Question One: Choose the correct answer and write it on the external answer booklet. 1. Java is. a. case
More informationCS 1302 Chapter 9 (Review) Object & Classes
CS 1302 Chapter 9 (Review) Object & Classes Reference Sections 9.2-9.5, 9.7-9.14 9.2 Defining Classes for Objects 1. A class is a blueprint (or template) for creating objects. A class defines the state
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.00 Introduction to Computers and Engineering Problem Solving. Quiz 1 March 7, 2003
1.00 Introduction to Computers and Engineering Problem Solving Quiz 1 March 7, 2003 Name: Email Address: TA: Section: You have 90 minutes to complete this exam. For coding questions, you do not need to
More informationIntroduction to Algorithms and Data Structures
Introduction to Algorithms and Data Structures Lecture 4 Structuring Data: Multidimensional Arrays, Arrays of Objects, and Objects Containing Arrays Grouping Data We don t buy individual eggs; we buy them
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 informationAP Computer Science Chapter 10 Implementing and Using Classes Study Guide
AP Computer Science Chapter 10 Implementing and Using Classes Study Guide 1. A class that uses a given class X is called a client of X. 2. Private features of a class can be directly accessed only within
More informationCOSC 1010 Introduction to Computer Programming
COSC 1010 Introduction to Computer Programming Exam 1, Spring 2016 Exam Duration: Sixty (60) Minutes The exam has three parts: Multiple Choice (17 points), Short Answer (30 points) and Programming (53
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 informationCOMPUTER SCIENCE DEPARTMENT PICNIC. Operations. Push the power button and hold. Once the light begins blinking, enter the room code
COMPUTER SCIENCE DEPARTMENT PICNIC Welcome to the 2016-2017 Academic year! Meet your faculty, department staff, and fellow students in a social setting. Food and drink will be provided. When: Saturday,
More informationCSC 1051 Algorithms and Data Structures I. Final Examination December 17, Name:
CSC 1051 Algorithms and Data Structures I Final Examination December 17, 2013 Name: Question Value 1 10 Score 2 10 3 10 4 10 5 10 6 10 7 10 8 10 9 20 TOTAL 100 Please answer questions in the spaces provided.
More informationSelected Questions from by Nageshwara Rao
Selected Questions from http://way2java.com by Nageshwara Rao Swaminathan J Amrita University swaminathanj@am.amrita.edu November 24, 2016 Swaminathan J (Amrita University) way2java.com (Nageshwara Rao)
More informationAP CS Unit 4: Classes and Objects Programs
AP CS Unit 4: Classes and Objects Programs 1. Copy the Bucket class. Make sure it compiles (but you won t be able to run it because it does not have a main method). public class Bucket { private double
More informationMidterm Practice Problems - answer key Answers appear in boldface.
Part 1. (a) Consider the following code segment: int p = 30; int b; Midterm Practice Problems - answer key Answers appear in boldface. System.out.print( Please enter an integer ); b = kb.nextint(); if
More informationThe Irving K. Barber School of Arts and Sciences COSC 111 Final Exam Winter Term II Instructor: Dr. Bowen Hui. Tuesday, April 19, 2016
First Name (Print): Last Name (Print): Student Number: The Irving K. Barber School of Arts and Sciences COSC 111 Final Exam Winter Term II 2016 Instructor: Dr. Bowen Hui Tuesday, April 19, 2016 Time: 6:00pm
More informationQuestion: Total Points: Score:
CS 170 Exam 1 Section 000 Spring 2015 Name (print): Instructions: Keep your eyes on your own paper and do your best to prevent anyone else from seeing your work. Do NOT communicate with anyone other than
More informationCOE 212 Engineering Programming. Welcome to Exam I Thursday June 21, Instructor: Dr. Wissam F. Fawaz
1 COE 212 Engineering Programming Welcome to Exam I Thursday June 21, 2018 Instructor: Dr. Wissam F. Fawaz Name: Student ID: Instructions: 1. This exam is Closed Book. Please do not forget to write your
More informationCSIS-120 Final Exam Fall 2015 Name:
1. Which line of code creates a Player object called player1 using the default constructor a) Player player1; b) Player player1 = new Player (); c) Player1 Player(); d) Player player1 = new Player ; e)
More information