The 3 rd and 4 th tutoring session -- A case study about using variables Fall, 2012 Haidong(Haydon) Xue 5:30pm8:30pm 9/11/2012 and 9/12/2012.

Slides:



Advertisements
Similar presentations
Chapter 4 Loops Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved
Advertisements

Writing Pseudocode And Making a Flow Chart A Number Guessing Game
Foundations of Programming and Problem Solving Introduction.
Introduction to Programming
Marywood Math Contest Saturday, March 29, 2014 Marywood University Liberal Arts Center 10:00 – 11:00 am (Arrive by 9:30 am)
Tables1 TABLES (chp. 12) group of storage locations (i.e. elements) with the same name accessed by name and subscript ex. var-name (sub) similar to arrays.
Design and Analysis of Algorithms Greedy algorithms, coin changing problem Haidong Xue Summer 2012, at GSU.
Programming Methodology (1). public class Hello { public static void main(String[] args) { System.out.println("Hello world"); } } Hello world.
1 CSC 221: Computer Programming I Fall 2006 interacting objects modular design: dot races constants, static fields cascading if-else, logical operators.
Make sure you know the day and time of the final exam for this section of Math 110: Day: ______ Date:______ Time: ______ to _______ All Math 110.
1.A computer game is an example of A.system software; B.a compiler; C.application software; D.hardware; E.none of the above. 2.JVM stands for: A.Java Virtual.
1 Arrays An array is a special kind of object that is used to store a collection of data. The data stored in an array must all be of the same type, whether.
1 Review Quisioner Kendala: Kurang paham materi. Praktikum Pengaruh teman.
Chapter 5 Loops Liang, Introduction to Java Programming, Tenth Edition, (c) 2015 Pearson Education, Inc. All rights reserved.
Review BP Dari slide pak cahyo pertemuan 7 dan pertemuan 2 dengan sedikit modifikasi.
Computing Science Software Design and Development SOFTWARE DESIGN AND DEVELOPMENT USING PYTHON.
Computer Programming Lab(7).
Building Java Programs Interactive Programs w/ Scanner What is a class? What is an object? What is the difference between primitive and object variables?
Sunday, Dec. 14 (the day before the first day of final exams) TAs Courtney Staycoff and Josh Kressmer will be on duty in the open lab (room 203) to answer.
We’ll be spending minutes talking about Quiz 1 that you’ll be taking at the next class session before you take the Gateway Quiz today.
L6:CSC © Dr. Basheer M. Nasef Lecture #6 By Dr. Basheer M. Nasef.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Chapter 3 Loops.
Computer Programming Lab 8.
1 9/29/06CS150 Introduction to Computer Science 1 Loops Section Page 255.
1 9/29/06CS150 Introduction to Computer Science 1 Loops Section Page 255.
1 9/28/07CS150 Introduction to Computer Science 1 Loops section 5.2, 5.4, 5.7.
JavaScript with Input & Output Step 1: Use tags JavaScript Template.
CSc2310 tutoring session, week 8 Fall, 2012 Haidong Xue 5:30pm—8:30pm 10/30/2012 and 10/31/2012 -Code PrintCalendar.
Chapter 2: Writing Java Programs Java Programming FROM THE BEGINNING Copyright © 2000 W. W. Norton & Company. All rights reserved. 1 Chapter 2 Writing.
CPS 2231 Computer Organization and Programming Instructor: Tian (Tina) Tian.
The 10 th and 11 th tutoring session Fall, 2012 Haidong Xue 5:30pm—8:30pm 10/9/2012 and 10/10/2012 -What is a class, what is an object and why we need.
Please open Daily Quiz 34. A scientific calculator may be used on this quiz. You can keep your yellow formula sheets out when you take the quiz. Remember.
CSc2310 tutoring session, week 7 Fall, 2012 Haidong Xue 5:30pm—8:30pm 10/9/2012 and 10/10/2012 -Using arrays -Case study: PhoneDirectory.
Program 6 Any questions?. System.in Does the opposite of System.out.
CSc2010 Lab Fall 2015 Bing Li. Contact  Name : Bing Li   Website : cs.gsu.edu/~bli6  Office : Suntrust.
CSc2310 tutoring session, week 8 Fall, 2012 Haidong Xue 5:30pm—8:30pm 10/23/2012 and 10/24/2012 -Using Exceptions -Homework 4.
More While Loop Examples CS303E: Elements of Computers and Programming.
CSc2310 tutoring session, week 8 Fall, 2012 Haidong(Haydon) Xue 5:30pm—8:30pm 11/27/2012 and 11/28/2012 -Class Members vs Instance Members.
Reviewing for Gateway #2 The second Gateway Quiz will be given at the next class session, after we review for Quiz 2 on sections If you have already.
Nested LOOPS.
CSc2310 tutoring session, week 8 Fall, 2012 Haidong Xue 5:30pm—8:30pm 11/06/2012 and 11/07/2012 -Test 3 Study Guide.
The 5 th and 6 th tutoring session - A case study about verifying a ISBN - Writing code for problems in HW1 Fall, 2012 Haidong(Haydon) Xue 5:30pm—8:30pm.
The 1 st and 2 nd tutoring session of CSc2310 Fall, 2012 Haidong Xue.
Welcome to the MTLC MATH 115 Spring MTLC Information  Hours of Operation  Sunday:4:00pm – 10:00pm  Monday – Thursday: 8:00am – 10:00pm  Friday:8:00am.
CSC Programming I Lecture 6 September 4, 2002.
Assignment statement and Arithmetic operation 1 The major part of data processing.
1 CS1430: Programming in C++ Section 2 Instructor: Qi Yang 213 Ullrich
The 9 th and 10 th tutoring session Fall, 2012 Haidong Xue 5:30pm—8:30pm 10/2/2012 and 10/3/2012 -Review loop structures and improve CheckISBN and CourseAverage.
Chapter 2: Writing Java Programs Java Programming FROM THE BEGINNING Copyright © 2000 W. W. Norton & Company. All rights reserved. 1 Chapter 2 Writing.
Textbook Problem Java – An Introduction to Problem Solving & Programming, Walter Savitch, pp.217, Problem 04.
Count Controlled Loops (Nested) Ain’t no sunshine when she’s gone …
Data Types and Conversions, Input from the Keyboard If you can't write it down in English, you can't code it. -- Peter Halpern If you lie to the computer,
Exercise 1 #include int main() { printf(“Hello C Programming!\n”); return 0; } 1.Run your Visual Studio 2008 or Create a new “project” and add.
Programming Problems Intermediate 2 Computing SHOW YOUR TEACHER YOUR WORKING PROGRAM AND WRITING FRAME THEN SAVE IN YOUR PROGRAMMING FOLDER AND UPDATE.
Please CLOSE YOUR LAPTOPS, and turn off and put away your cell phones, and get out your note- taking materials.
The 7 th and 8 th tutoring session Fall, 2012 Haidong(Haydon) Xue 5:30pm—8:30pm 9/25/2012 and 9/26/ Review control structures - Improve CheckISBN.
Computer Programming 12 Mr. Jean March 5 th, 2014.
1 Project 4: Computing Distance. 222 Computing Distance Write a program to compute the distance between two points. Recall that the distance between the.
Chapter 2: Writing Java Programs Java Programming FROM THE BEGINNING Copyright © 2000 W. W. Norton & Company. All rights reserved. 1 Chapter 2 Writing.
For Friday Finish reading chapter 9 WebCT quiz 17.
Chapter 7: Class Variables and Methods Java Programming FROM THE BEGINNING Copyright © 2000 W. W. Norton & Company. All rights reserved. 1 Class Methods.
Data Types and Conversions, Input from the Keyboard
Haidong Xue Summer 2011, at GSU
Haidong Xue Summer 2011, at GSU
Haidong Xue Summer 2011, at GSU
For Monday Read WebCT quiz 18.
CS 1430: Programming in C++ Turn in your Quiz1-2 No time to cover HiC.
CS212 Data Structures 2018 Second Semester.
For Wednesday No new reading No quiz.
Haidong Xue Summer 2011, at GSU
Presentation transcript:

The 3 rd and 4 th tutoring session -- A case study about using variables Fall, 2012 Haidong(Haydon) Xue 5:30pm8:30pm 9/11/2012 and 9/12/2012

CSc2310 Tutoring Time: 5:30pm-8:30pm Tutor: Haidong Xue (You can call me Haydon) There are 2 sections: 1. Review 5:30pm – 6:30pm A case study, and make a program for this case. 2. Q&A If you have any questions about Java programming, I am right here

Computing a course average -- Overview The CourseAverage program will calculate a class average, using the following percentages: Programs30% // 8 programs Quizzes10% // 5 quizzes Test 115% Test 215% Final exam30% courseAverage =.30 programAverage quizAverage test test finalExam The user will enter the grade for each program (0–20), the score on each quiz (0–10), and the grades on the two tests and the final (0–100). There will be eight programs and five quizzes.

Computing a course average – A legal output Welcome to the CSc2310 average calculation program. Enter program 1 score (0-20):20 Enter program 2 score (0-20):20 Enter program 3 score (0-20):20 Enter program 4 score (0-20):20 Enter program 5 score (0-20):20 Enter program 6 score (0-20):20 Enter program 7 score (0-20):20 Enter program 8 score (0-20):20 Enter quiz 1 score (0-10):10 Enter quiz 2 score (0-10):10 Enter quiz 3 score (0-10):10 Enter quiz 4 score (0-10):10 Enter quiz 5 score (0-10):10 Enter test 1 score (0-100):100 Enter test 2 score (0-100):100 Enter final exam score (0-100):100 The final grade is: 100 (Users inputs are in red font)

Computing a course average – What should we finish for it?

1. Print the introductory message ("Welcome to the CSc 2310 average calculation program"). 2. Prompt the user to enter eight program scores. 3. Compute the program average from the eight scores. 4. Prompt the user to enter five quiz scores. 5. Compute the quiz average from the five scores. 6. Prompt the user to enter scores on the tests and final exam. 7. Compute the course average from the program average, quiz average, test scores, and final exam score. 8. Round the course average to the nearest integer and display it.

Lets code it step by step! Please get your Eclipse ready Create a class named CourseAverage with main method If you are not very confident, please download and open this code first (it is the finished program): /CourseAverage.java

Lets code it step by step! 1. Print the introductory message ("Welcome to the CSc 2310 average calculation program"). Code:

Lets code it step by step! 1. Print the introductory message ("Welcome to the CSc 2310 average calculation program"). Code: // Print the introductory message System.out.println("Welcome to the CSc2310 average calculation program.");

Lets code it step by step! 2. Prompt the user to enter eight program scores. Code:

Lets code it step by step! 2. Prompt the user to enter eight program scores. Code: // Create a Scanner Scanner s = new Scanner(System.in); // Collect 8 program scores System.out.print("Enter program 1 score (0-20):"); double program1 = s.nextDouble(); System.out.print("Enter program 2 score (0-20):"); double program2 = s.nextDouble();

System.out.print("Enter program 3 score (0-20):"); double program3 = s.nextDouble(); System.out.print("Enter program 4 score (0-20):"); double program4 = s.nextDouble(); System.out.print("Enter program 5 score (0-20):"); double program5 = s.nextDouble(); System.out.print("Enter program 6 score (0-20):"); double program6 = s.nextDouble(); System.out.print("Enter program 7 score (0-20):"); double program7 = s.nextDouble(); System.out.print("Enter program 8 score (0-20):"); double program8 = s.nextDouble();

Lets code it step by step! 3. Compute the program average from the eight scores. Code:

Lets code it step by step! 3. Compute the program average from the eight scores. Code: // Calculate the average program score double programAverage = (program1 + program2 + program3 + program4 + program5 + program6 + program7 + program8)/8;

Lets code it step by step! 4. Prompt the user to enter five quiz scores. Code:

Lets code it step by step! 4. Prompt the user to enter five quiz scores. Code: // Collect 5 quiz scores System.out.print("Enter quiz 1 score (0-10):"); double quiz1 = s.nextDouble(); System.out.print("Enter quiz 2 score (0-10):"); double quiz2 = s.nextDouble(); System.out.print("Enter quiz 3 score (0-10):"); double quiz3 = s.nextDouble(); System.out.print("Enter quiz 4 score (0-10):"); double quiz4 = s.nextDouble(); System.out.print("Enter quiz 5 score (0-10):"); double quiz5 = s.nextDouble();

Lets code it step by step! 5. Compute the quiz average from the five scores. Code:

Lets code it step by step! 5. Compute the quiz average from the five scores. Code: // Calculate the average quiz score double quizAverage = (quiz1 + quiz2 + quiz3 + quiz4 + quiz5)/5;

Lets code it step by step! 6. Prompt the user to enter scores on the tests and final exam. Code:

Lets code it step by step! 6. Prompt the user to enter scores on the tests and final exam. Code: // Collect 2 test scores System.out.print("Enter test 1 score (0-100):"); double test1 = s.nextDouble(); System.out.print("Enter test 2 score (0-100):"); double test2 = s.nextDouble(); // Collect the final test score System.out.println("Enter final exam score (0-100):"); double finalExam = s.nextDouble();

Lets code it step by step! 7. Compute the course average from the program average, quiz average, test scores, and final exam score. Code:

Lets code it step by step! 7. Compute the course average from the program average, quiz average, test scores, and final exam score. Code: // Calculate the course average double courseAverage =.30 * programAverage * * quizAverage * * test * test * finalExam;

Lets code it step by step! 8. Round the course average to the nearest integer and display it. Code:

Lets code it step by step! 8. Round the course average to the nearest integer and display it. Code: // Output the course average System.out.println("The final grade is: " + Math.round(courseAverage));

Run this program Please run your code, and let me know your questions. The finished code is at: /CourseAverage.java

If you have any questions about this program or java programming, I will be here till 8:30pm