1 / 15

Test1

Test1. Ask me if you have any questions Redo it and show me if your score is below 40. Quiz4-1. How to compute Gross Pay? Rate : 10 Hours: 40 Gross: 40 * 10 Rate : 10 Hours: 52 Gross: 40 * 10 + 12 * (1.5 * 10) Due 5 pm Today!. Program 1. Style Descriptive name

carl
Download Presentation

Test1

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. Test1 • Ask me if you have any questions • Redo it and show me if your score is below 40

  2. Quiz4-1 How to compute Gross Pay? Rate : 10 Hours: 40 Gross: 40 * 10 Rate : 10 Hours: 52 Gross: 40 * 10 + 12 * (1.5 * 10) Due 5 pm Today!

  3. Program 1 • Style Descriptive name Indentation Line too long • Unused code Not style

  4. Program 2 • Due Wednesday, March 2 • Individual Assignment • OK to get LIMITED help from others • DO NOT work as a group • DO NOT copy from others • DO NOT let others copy your code • Program Plagiarism

  5. Find Max, Min, Average of m Sections Max, Min and Average of each section Max, Min and Average of all sections together Note09 Prog2: multiple routes multiple deliveries for each route

  6. Computing Total Distance startX = 0 and startY = 0 While not end of route Read endX and endY Compute the distance between start and end add to the total distance Set startX and startY to endX and endY Update count

  7. Determining the Winner If first route Set winnerNum Set minTotalDistance and maxDeiveries Else Three possibilities The new route is the winner No winner The previous winner still winner

  8. Three possibilities // The new route is the winner if (totalDistance < minTotalDistance && numDeiveries > maxDeiveries) // update winnerNum, // minTotalDistance and maxDeiveries // No winner else if (totalDistance =< minTotalDistance || numDeiveries >= maxDeiveries) // update winnerNum to -1 // minTotalDistance and maxDeiveries // The previous winner still winner else // do nothing

  9. Prog2 Winner // No winner for now else if (totalDistance =< minTotalDistance || numDeiveries >= maxDeiveries) { winnerNum = -1; if (totalDistance < minTotalDistance) minTotalDistance = totalDistance; if (numDeiveries > maxDeiveries) maxDeiveries = numDeiveries; }

  10. Prog2 Winner: Another Way if (totalDistance < minTotalDistance && numDeiveries > maxDeiveries) . . . else { if (totalDistance =< minTotalDistance) { winnerNum = -1; minTotalDistance = totalDistance; } // No else ! if (numDeiveries >= maxDeiveries) { winnerNum = -1; maxDeiveries = numDeiveries; } }

  11. Prog2 Winner: Another Way if (routeNum == 1) { distWinnerNum = routeNum; delWinnerNum = routeNum; minTotalDistance = totalDistance; maxDeiveries = numDeiveries; } else { if (totalDistance < minTotalDistance) { distWinnerNum = routeNum; minTotalDistance = totalDistance; } else if (totalDistance == minTotalDistance) { distWinnerNum = routeNum; } // else prev distWinnerNum still winner // same if – else if for delWinnerNum }

  12. CS1430: No Prerequisite • Any one can take CS143 • Not any one can pass CS143 • D/F rate: 25-40% • Recommendation: • Previous programming experience such as CS 1130 • (Math) • (English)

  13. Why is CS1430 Very Difficult? • Understand concepts • Make programs work • Follow rules

  14. Good Luck! • Come to classes/labs • Do the work by yourself • Get Help • Review Notes • Follow Instructions • Pay attention to details

  15. Go to Lab 206 • Quiz4-1 • Prog2 • Test 1

More Related