math operators and a challenge
Download
Skip this Video
Download Presentation
Math operators and a challenge

Loading in 2 Seconds...

play fullscreen
1 / 8

Math operators and a challenge - PowerPoint PPT Presentation


  • 99 Views
  • Uploaded on

Math operators and a challenge. Mastery Objectives: Students will— Be able to use augment assignment operators Demonstrate proficiency in using types, variables and simple i/O. Augmented assignment operators. Another way to write a math calculation Less code, harder to read.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Math operators and a challenge' - galena


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
math operators and a challenge

Math operators and a challenge

Mastery Objectives: Students will—

Be able to use augment assignment operators

Demonstrate proficiency in using types, variables and simple i/O

augmented assignment operators
Augmented assignment operators
  • Another way to write a math calculation
  • Less code, harder to read
useful augment assignment operators
Useful Augment Assignment Operators

Operator Example Equivalent

*= x*=5 x=x*5

/= x/=5 x=x/2

%= x%=5 x=x%5

+= x+=5 x=x+5

-= x-=5 x=x-5

example
Example

food = food * 52

Or

food *= 52

printing strings and numbers together
Printing Strings and Numbers Together

print “Grand Total: “, total

print “Grand Total: “ + total

programming challenges
Programming Challenges
  • Write a program that allows a user to enter his or her two favorite foods. The program should print out the name of a new food by joining the two food names together.
  • Write a Tip program where the user enters a restaurant bill total. The program should then display two amounts: a 15-percent tip and a 20-percent tip.
programming challenges continued
Programming Challenges continued
  • Write a Car Salesman program where the user enters the base price of a car. The program should add to the base price tax, license, dealer prep, and destination charge. Make tax and license a percent of the base price. The other fees should be set values. Display the actual price of the car once the extras are applied.
how to turn in challenges
How to turn in Challenges
  • Make sure to comment in your name
  • Print out a copy of the code and the output
  • Staple both copies together: code first, output second
  • Turn in all three challenges as a packet using a paper clip to clip them all together.
ad