Assignment 3 CS 113

Good Essays
Topics: Number, Statement, Output
Assignment 3 (100 points)
CS 113 Fall 2014
Due Date: See Syllabus
Name & UCID & Section Number: Please write your name, UCID, and section number on the submission – please staple together – no loose sheets

What is to be submitted?
1. Problem 1: Answers to the exercises
2. Problem 2: Program listing with the program output using the input in file Data3.txt and user interaction based on the input you have entered.

1. Exercises (25 points)
a) (20 points) Show the syntax (form) , explain its meaning, and give an example of each of
i. while loop, ii. for loop, iii. if statement, iv. array (give an example declaration and its use), and
v. boolean type
b) (5 points) What does a break statement do when executed inside a loop?

2. Directory1 Lookup Application (75 points)
What is the assignment?
Write a directory (database) lookup application which operates by
1. reading a list of numbers stored in file Data3.txt to create a database of numbers:

1

The word directory is used here as it use in "telephone" directory or a "store" directory" as opposed to its use in
"file" directory which refers to the organization of files in a computer system such as Unix or Linux.

CS 113 Fall 2013 – Assignment 3

1/4




The list of numbers is preceded by a number (first number in the list) that specifies the size of the list.
This file name Data3.txt is supplied as a command-line argument to the application. 2. accepting user input (supplied at the keyboard) which are numbers that it checks to see whether or not they are in its database.
For each number x input by the user the program displays (prints) “x is in the list” or
“x is not in the list” depending upon whether or not x is in the list.
The program terminates when the user enters Ctrl-Z (Ctrl-D) on the keyboard.

Input File Data3.txt
14
21
222
210
-44
78
88
96
0
-1
88
7890
567
999
-101
The list has 14 values as indicated by the first value in the file.

Sample user interaction (submit your version of the user interaction)

You May Also Find These Documents Helpful

  • Satisfactory Essays

    Hnd Cs Assignments

    • 3297 Words
    • 14 Pages

    what it means to copy another’s work. 1. I know that plagiarism is a punishable offence because it constitutes theft. 2. I understand the plagiarism and copying policy of the Edexcel UK. 3. I know what the consequences will be if I plagiaries or copy another’s work in any of the assignments for this program. 4. I declare therefore that all work presented by me for every aspects of my program, will be my own, and where I have made use of another’s work,…

    • 3297 Words
    • 14 Pages
    Satisfactory Essays
  • Good Essays

    Cs 2204 Unit 3

    • 804 Words
    • 4 Pages

    Running head: CS 2204: COMMUNICATIONS AND NETWORKING WRITTEN ASSIGNMENT UNIT 3 CS 2204: Communication and Networking 1 University of the People Term 2 (2016-2017) November 29/2016 Answer the following questions in your own words, in no more than 4 sentences each…

    • 804 Words
    • 4 Pages
    Good Essays
  • Satisfactory Essays

    CS 486/686 Fall 2012 Assignment 2 Solutions March 1, 2014 Question 2a 1 Question 2b Part I - Prior Probability P r(f raud) = P r(f raud|trav)P r(trav) + P r(f raud|¬trav)P r(¬trav) = 0.01 ∗ 0.05 + 0.004 ∗ 0.95 = 0.0043 Part II - Posterior Probability OC t f f1 (OC) = P r(OC) 0.7 0.3 T rav t f t f f2 (F raud, T rav) = P r(F raud|T rav) 0.01 0.004 0.99 0.996 T rav t f f3 (T rav) = P r(T rav) 0.05 0.95 OC t f f4 (OC) = P r(crp|OC) 0.1 0.001…

    • 885 Words
    • 4 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Assignment 1 CS 275

    • 597 Words
    • 3 Pages

    Assignment #1, 11th Edition Review Question #2) 1) Data C 2) Database Application B 3) Constraint L 4) Repository G 5) Metadata F 6) Data Warehouse M 7) Information A 8) User View J 9) Database Management System K 10) Data Independence H 11) Database E 12) Enterprise Resource Systems Planning I 13) Systems Development Life Cycle R 14) Prototyping O 15) Enterprise Data Model D 16) Conceptual Schema Q 17) Internal Schema P 18) External Schema N Problems & Exercises: 1) Attached…

    • 597 Words
    • 3 Pages
    Satisfactory Essays
  • Powerful Essays

    CS-669 Assignment 1

    • 985 Words
    • 4 Pages

    The two parts in this assignment will contribute equally to your grade and will be evaluated separately. Part 1: Database Concepts Imagine that a countryside inn maintains its data in flat files on a file system. To assist in reserving rooms and booking guests, the innkeepers use a custom application that accesses these flat files. The innkeepers sometimes access the files directly. With this scenario in mind, address each of the topics below. Topic 1: The Advantages of Database Management…

    • 985 Words
    • 4 Pages
    Powerful Essays
  • Good Essays

    Cs 2205 Unit 6 Assignment

    • 533 Words
    • 3 Pages

    CS 2205: WEB PROGRAMMING 1 written Assignment Unit 6 Short brief summary This is unit 6 personal reflections that basically depends on the unit given reading materials and that is related to. This week my journal activity basically very focused specifically on the weekly unit topic of basic syntax of XML, transporting and storing with XML. In the unit activity, I started as usual with unit text reading materials which have given in unit Learning Guide Unit 6 Overview. This has a great support of…

    • 533 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    English 113

    • 471 Words
    • 2 Pages

    Story: Where Are You Going, Where Have You Been Author: Joyce Carol Oates First Reaction: My reaction to the story was disbelief, it was hard for me to fathom anyone much less an entire village agreeing to such barbaric practices and creating and following a tradition where you stone and hurt or kill family and friends. Characterization The story is told in third person most of the time, it seems to be a village member who narrates the story, they are familiar with the village and the people…

    • 471 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    PROJECT DESCRIPTION Northwestern Swimming (NWS) manages athlete and coach data for swim teams with different locations in Washington. Athletes include developmental swimmers who are learning to swim and national-level athletes who have competed at the Olympic and world-championship levels. Julia Montoya is the General Chairperson of NWS and has just received approval from the Board of Directors to replace NWS’s manual system of managing data about athletes, coaches, and teams with a database. She…

    • 2671 Words
    • 11 Pages
    Good Essays
  • Powerful Essays

    Assignment 3

    • 2530 Words
    • 11 Pages

    NORTHCENTRAL UNIVERSITY ASSIGNMENT COVER SHEET Student: Jason D. THIS FORM MUST BE COMPLETELY FILLED IN Follow these procedures: If requested by your instructor, please include an assignment cover sheet. This will become the first page of your assignment. In addition, your assignment header should include your last name, first initial, course code, dash, and assignment number. This should be left justified, with the page number right justified. For example: KnightJSKS7000-8…

    • 2530 Words
    • 11 Pages
    Powerful Essays
  • Satisfactory Essays

    Assignment 3

    • 255 Words
    • 2 Pages

    Assignment 3 ECON 103: Pingle A. The federal government recently ran a budget surplus, but has since returned to running a budget deficit. 1. Explain why reducing the budget deficit can cause short-term pain in the form of lower employment, higher unemployment, and a recession. 2. Explain why expansionary monetary policy would help decrease the likelihood of a recession if it were adopted at the same time the budget deficit was being reduced. 3. Present an analysis that identifies any long…

    • 255 Words
    • 2 Pages
    Satisfactory Essays