CS112 Computer Programming I, Fall 2017


  • Syllabus 
  • Course Policies
  • Code in classroom: click here
  • Assignments. Requirements: For programming assignments, use proper comments and format for the code and its detailed I/O examples; BOTH of the programs and the I/O (for file I/O, screen-shots for command window and the results or output file needed) copied to ONE document named as CS112assignment#_FirstnameLastname.doc (ALL projects should be copied into one document). Email the document as attachment to the instructor (usvwccs@gmail.com). The email subject is the same as the file name.
    • Assignment 1 (Due: Wed. 9/13) Project a) write a program to draw three BIG letters, "VWU". Each letter of the letters  is composed of many of the same character. For example, the big letter 'V' consists of many v's. Project b) write a program to prompt a message and let the user to input the length of a square, and then the program outputs the area of the square to the monitor.
    • Assignment 2 (Due: Mon. 9/18) Project a) write a program that prompts a message, reads three real numbers (from the keyboard), and then outputs their average value (to the monitor). Project b) your program will read the radius (r) and height (h) of a cylinder and output its surface area (2πr2 + 2πhr) and volume (πhr2). Project c) your program will "interview" 4a traveler at the Beach on his/her nickname, job, hobby and other topics, and at last, the program lists the facts on the traveler by displaying: "In conclusion, the traveler's nickname is ____; he/she is a ____; he/she is interested in ____; he/she come here (Virginia Beach) because ____, ...".
    • Assignment 3 (Due: Wed. 9/20) Project a) You program will read the radius (r) of a sphere and output its surface area (4πr2) and volume (4/3πr3). Display the results to two decimal places. Project b) Your program will read a temperature in Fahrenheit (TF) and output its corresponding value in Celsius (TC). The conversion formula is TC = 5/9(TF-32). Display the result to two decimal places.
    • Assignment 4 (Due: Mon. 9/25) Project a) write a program to collect the basic info (student id, first and last name) and his/her three test scores (integers) and then display a summary for the student including all of the above data as well as the average score (display to two decimal places). Project b) You program will read the radius (r) and the height (h) of a cone and output its surface area (πrs + πr2) and volume (1/3πr2h). Display the results to two decimal places. Project c) Your program will read a distance in mile (Dmi) and output its corresponding value in kilometer (Dkm). The conversion formula is Dkm = Dmi 1.609344. Display the result to two decimal places. 
    • Assignment 5 (Due: Wed. 10/04) Project a)  write a program to collect the basic info (student id, full name) of the 1st student, and his/her three test scores (integers); and then same info for the 2nd student. The code will display a summary for both of students including IDs, names as well as their average scores (display to two decimal places). 
    • Assignment 6 (Due: Mon. 10/9) Project a) The program will prompt messages and let the user input the following three data for each of the two objects (total of SIX inputs): i) radius; ii) height; iii) "a cylinder" or "a cone" (can be any order). And then the code will display the volume and surface area for both objects. Project b) The code will prompt messages and let the user input four test scores (integers) and then student's full name (MUST in this order). The code display the student's full name and average score to the monitor. Display the results to two decimal places.
    • Assignment 7 (Due: Wed. 10/18) Project a) The code will read a file (right-click here to download) containing the real estate data including property ID (PID), assessment value ($), owner, city, annual tax rate (%), and compute the annual tax for each individual in the file. The code will display PID, owner, and annual tax to the monitor. 
    • Assignment 8 (Due: Mon. 10/23) Project a) The program will prompt a message and let the user input (from the keyboard) three coefficients a, b, and c (all real numbers) of the quadratic equation, ax2+bx+c = 0 and calculate its solution. Display the results to one decimal place. If the equation has no real solutions, display a message to say so. Hint: see example from p.65-p.66. Project b) Write the program to convert the values in foot to meter, or meter to foot. The code will prompt a message, and let the user type "0", or "1". If "0" is typed, the conversion is from foot to meter, and then prompt and let use input the value in foot, and the program outputs the corresponding value in meter. Otherwise, if "1" is typed, and the conversion is from meter to foot. Display the result to one decimal place. Hint: 1 foot = 0.3048 meters. Requirements: for the projects related to if-statements, the screen-shot examples should include two or more cases depending on the number of conditions, i.e. three screen-shots for Project a and two for Project b
    • Assignment 9 (Due: Mon. 11/6) Project a) Write the program to convert the values in foot to meter, or meter to foot. The code will prompt a message, and let the user type "f", or "m". If "f" is typed, the conversion is from foot to meter, and then prompt and let use input the value in foot, and the program outputs the corresponding value in meter. Otherwise, if "m" is typed, and the conversion is from meter to foot. Display the result to one decimal place. Hint: 1 foot = 0.3048 meters. Project b) The program will prompt a message and let the user input (from the keyboard) two English words and then output them in ascending order. 
    • Assignment 10 (Due: Wed. 11/8) Project a) The program will prompt a message and let the user input two positive integers M and N (assuming 0<M<N). The program will perform the following tasks: i) output all numbers between M and N (including the two numbers) to the monitor; ii) sum up all numbers between M and N to the monitor.
    • Assignment 11 (Due: Mon. 11/13) Project a)  The program will read a data file (click here to download), and perform the following tasks: i)  calculate the total value of the first 30 data and display the result to the monitor; ii) calculate the average value of the first 30 data, and display the result to one decimal place. Project b)  The program will read a data file (click here to download), and perform the following tasks: i)  calculate the total value of the data in the file and display the result to the monitor; ii) calculate the average value of all data in the file, and display the result to one decimal place. Project c) The program will prompt a message and let the user input two integers M and N (assuming 0<M<N). And then the program will perform the following task: output all odd numbers between M and N (not including M and N) to the monitor.  
    • Assignment 12 (Due: Wed. 11/15) Project a)Write a program that will read names (single-word name) from a file ( Click here to download) and perform the following tasks: i) output the total # of names to the monitor; ii) output the total # of "John" in the file to the monitor.
    • To be updated
    •        
     
  • Topics covered:
    • 8/28 Syllabus; intro
    • 8/30 Simple java codes: Hello, Trangle; Greeting. Special characters: '\n', '\t'
    • 9/6 String concatenation operator +; variables; input a decimal from keyboard
    • 9/11 Read a word from keyboard; interactive I/O 
    • 9/13 Read an integer from keyboard. Calculate the area and volume of a prism
    • 9/18 Java methods for Math formula. Display decimals
    • 9/20 Java for math expressions. Calculation of a cone and square based pyramid
    • 9/25 More on Java for math expressions 
    • 9/27 Test 1A 
    • 10/2 On test; read a whole line string
    • 10/4 More on input - redirection input by using file
    • 10/9 More on file input with redirection
    • 10/11 Selection with if-statement
    • 10/16 Nested if-else
    • 10/18 More on nested if-else
    • 10/23 Review; worksheet
    • 10/25 Test 1B
    • 10/30 On Test 1B; string comparisons; example with Celsius and Fahrenheit
    • 11/01 While-loops
    • 11/06 Counter-ctrl loops; EOF-ctrl loops
    • 11/08 Sentinel-ctrl loops
    • 11/13 More on loops; for loops 
    • 11/15 Worksheet 
    • 11/20 Test 2
    • 11/27
    • 11/29
    • 12/04
    • 12/06 Review for final exam
    • 12/13 (Wed) Final Exam: 11:30-14 (sec.1) 15-17:30 (sec.2) 
    •  

  • Code in the past years
    • Fall'16 (click here)
    • Fall'15 (click here)
    • Fall'13 (click here)
    • Fall'12 (click here)
    • Fall'11 (click here)

  • Download and install Java (click here) to C:\Program Files(x86): following the steps (for Windows OS that is recommended) - 

    • Find and click version 8 or older version - JDK (be careful - NOT JRE) Download
    • Download and save the file for Windows x86 (be careful - NOT Windows x64) that is similar to jdk-***-windows-i586.exe  (i.e. jdk-8u101-windows-i586.exe)
    • Run the downloaded file jdk-***-windows-i586.exe  and install it to C:\Program Files (x86)
  • AFTER Java IS installed, download and install TextPad 4 or 5 (click here. Choose 32-bit for TextPad 6 or 7), and configuration will be done automatically. Both Java and TextPad should be on C:\Program Files (x86). 
  • Java 6 documentation

Note: Tutoring schedue for CS 112 (no charge) at Learning and Writing Centers at Clarke 223. MW 10am-12pm (Tutor: Mr. Chris McTague), 3pm-6pm (Tutor: Mr. Kevin Murray), Thur. 11am-12pm and Fri. 8:30am-10am (Tutor: Mr. James Ficklin)


Copyright Since 2000, Dr. John Wang, Virginia Wesleyan University, 5817 Wesleyan Drive, Virginia Beach, VA 23455 
Updated on Monday, November 13, 2017  by zwang@vwu.edu
 
http://zwang.vwc.edu/~jwang/OneOneTwo