1 / 12

For Wednesday

For Wednesday. No new reading No quiz. Program 6. Any questions?. Objects and Records. Approaches to reading objects Approaches to writing objects Issues to deal with New lines Multiple word fields. The File Class. Contains a number of methods

meaghan
Download Presentation

For Wednesday

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. For Wednesday • No new reading • No quiz

  2. Program 6 • Any questions?

  3. Objects and Records • Approaches to reading objects • Approaches to writing objects • Issues to deal with • New lines • Multiple word fields

  4. The File Class • Contains a number of methods • Useful for answering questions about files

  5. Interacting with the User • How is this similar to files? • How is it different?

  6. System.in

  7. Practice • Design and write a program that will prompt for, receive, and total a collection of payroll amounts entered by the user until a sentinel amount of -99 is entered. After the sentinel has been entered, display the total payroll amount on the screen.

  8. Problem 2 • Write a program that finds the smallest of several integers. Assume that input will end when a sentinel value of –999 is read. Do not count –999 as one of the integers to consider.

  9. Problem 3 • Write a program that sums a sequence of integers. Assume that the first integer read specifies the number of values remaining to be entered. Your program should read only one value at a time. A typical input sequence might be 5 100 200 300 400 500

  10. Practice Problem • Write Java code to ask for a student’s exam score out of 100. Your program is then to match the exam score to a letter grade and print the grade to the screen. The letter grade is to be calculated as follows: 90 and above A 80-89 B 70-79 C 60-69 D below 60 F

  11. Switch Practice • A program is required to read a customer’s name, a purchase amount and a tax code. The tax has been validated and will be one of the following: 0 tax exempt (0%) 1 state sales tax only (3%) 2 federal and state sales tax (5%) 3 special sales tax (7%)The program must then compute the sales tax and the total amount due and print the customer’s name, purchase amount, sales tax and total amount due.

  12. JFileChooser

More Related