1 / 13

CISC 130 - Today’s Class

CISC 130 - Today’s Class. Recap Project Proposal Problem 12 Final notes on Problem 11. Recap. Problem 11 Problem 12 Objectives Scaling. Projects!!. Proposal Due Thursday! (Tomorrow) Plan due Next Wednesday! Let’s look at the Project…. Assignment 12: Scaling. Date Due: Next Monday

Download Presentation

CISC 130 - Today’s Class

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. CISC 130 - Today’s Class • Recap • Project Proposal • Problem 12 • Final notes on Problem 11 R. Smith - University of St Thomas - Minnesota

  2. Recap • Problem 11 • Problem 12 • Objectives • Scaling R. Smith - University of St Thomas - Minnesota

  3. Projects!! • Proposal Due Thursday! (Tomorrow) • Plan due Next Wednesday! • Let’s look at the Project… R. Smith - University of St Thomas - Minnesota

  4. Assignment 12: Scaling • Date Due: Next Monday • The problem: • Taking a set of data and scaling it to fit a particular range • A common lab data problem • What we’ll do • Read in a file of data to be scaled • Calculate scaled values • Print out the original data w/scaled horizontal histogram R. Smith - University of St Thomas - Minnesota

  5. Assignment 12: The File • Line-oriented file again, like in A11 • Name/Number instead of Number/Name • Separated by tab character “\t” • Read “names” into one array • Read “numbers” into a separate array • Use a third integer array for scaled values R. Smith - University of St Thomas - Minnesota

  6. How Scaling Works • Scan the raw data in the array • Find the minimum and maximum values • Minimum maps to 0 in scaled values • Maximum maps to 31 in scaled values • Calculate the scaling ratio • Range of desired values / range of actual values • scale = 31.0 / (max – min) • A real number, not an int • Apply the ratio and round the result • Subtract ‘min’ before scaling • Use “rint()” function from math.h • Save scaled values in the scaled array R. Smith - University of St Thomas - Minnesota

  7. Unscaled Values 200 1000 253 600 999 823 410 Scaled Values 0 31 2 16 31 24 8 Example Scaling R. Smith - University of St Thomas - Minnesota

  8. The Histogram • Horizontal Format • Left side of display: name and unscaled value • Right side: histogram of scaled value R. Smith - University of St Thomas - Minnesota

  9. Sample Input • Moose Mountain 986 • Mystery Mountain 650 • Eagle Mountain 650 • Ullr Mountain 350 • Welch Village 360 • Spirit Mountain 700 • Keystone 3128 • Steamboat Springs 3668 • Sunday River 2340 R. Smith - University of St Thomas - Minnesota

  10. Looking at the Assignment • It’s almost all recycling from other programs • One nit – you need a char->decimal conversion • Let’s play with that. R. Smith - University of St Thomas - Minnesota

  11. Looking at the Assignment • The assignment outlines how to recycle functions you’ve written already. • If you have questions, ask. R. Smith - University of St Thomas - Minnesota

  12. Final Notes on Assignment 11 • The comments must match your code! • If you think there may be discrepancies, fix them and resubmit! • You should be able to do this without breaking your code. • But– be sure to test your code after you make any changes, even if you’re just changing comments. R. Smith - University of St Thomas - Minnesota

  13. Creative Commons License This work is licensed under the Creative Commons Attribution-Share Alike 3.0 United States License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/us/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. R. Smith - University of St Thomas - Minnesota

More Related