Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2) Polya problem solving 1 [COLLABORATIVE, 15%] Consider the points A, B, and C defined by the following cartesian coordinates: Point y A 1 1

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
2) Polya problem solving 1 [COLLABORATIVE, 15%] Consider the points A, B, and C defined by the following cartesian coordinates: Point y A 1 1 B 5 1 c 5 4 Your task is to find out if the triangle formed by the points A, B, and is a right triangle. Apply Polya's problem solving technique 1. Understand the problem. In a code comment, write the question you are trying to solve in your own words, then create objects for each relevant piece of information provided in the problem statement 2. Devise a plan: In code comments, describe the steps you will take in your plan to solve the problem 3. Carry out the plan: Write code below your comments to carry out your plan 4. Check your work. Examine your solution and any intermediate values you computed along the way. Do the values make sense (0.9. do you get negative numbers when you expected positive numbers)? Is there another way you could have solved it to check that you get the same result? 3) Polya problem solving 2 [COLLABORATIVE, 20%] Kevin is deciding between purchasing a Chevy Bolt, which sells for $29,390 (after subsidies), and a Toyota Camry, which sells for $24,000. The Bolt efficiency is 28 kWh of electricity per 100 miles while the Camry efficiency is 28 miles per gallon (mpg) MacBook Pro TO C OD you get the same result? 3) Polya problem solving 2 [COLLABORATIVE, 20%) Kevin is deciding between purchasing a Chevy Bolt, which sells for $29,390 (after subsidies), and a Toyota Camry, which sells for $24,000. The Bolt efficiency is 28 kWh of electricity per 100 miles while the Camry efficiency is 28 miles per gallon (mpg) on average. The average price of electricity (in DC, where Kevin lives) is $0.13/ kWh, and the average price of gasoline is $3.00 /gallonKevin drives 12,000 miles each year on average To help him make a decision about which car to buy, answer the following questions a. How long (in years) would he have to drive the Bolt for the money he saves in fuel savings to be greater than the price premium compared to the Camry? b. What would the price of gasoline need to be such that the fuel savings from driving the Bolt for 3 years would be greater than the price premium compared to the Camry? C. How many miles would Kevin need to drive each year such that the fuel savings from driving the Bolt for 3 years would be greater than the price premium compared to the Camry? To solve each problem, apply Polya's problem solving technique: 1. Understand the problem: In a code comment, write the question you are trying to solve in your own words, then create objects for each relevant piece of information provided in the problem statement 2. Devise a plan: In code comments, describe the steps you will take in your plan to solve the problem 3. Carry out the plan: Write code below your comments to carry out your plan 4. Check your work: Examine your solution and any intermediate values you computed along the way. Do the values make sense (eg. do you get negative numbers when you expected positive numbers)? Is there another way you could have solved it to check that you get the same result? 4) Working with strings: the stringr package (SOLO, 15%) MACBOOK Pro solved it to check that you get the same result? 4) Working with strings: the stringr package (SOLO, 15%] Who is your favorite super hero character? If you don't already have one, pick one (mine is Professor Xavier, and no it's not just because he's a professor :P). In your hw2.R file, create two objects that store the following character values: The name of your favorite super hero The super power(s) your hero has. Use meaningful variable names to store these values Next, install the string package. Try using the str_to_lower (Her_to_upper(), and str_to_title() functions from the string package on the objects you created in a code comment, describe what these functions do Finally, use the paste) function to merge your super hero's name and power in a coherent sentence. For example, if the name is "Professor Xavier and the the power is "reado peoples' minds", then a final sentence might be: "Processor Xavier reads peoples' mindst". (Note that I intentionally did not tell you how to use the paste) function...you'll have to figure that one out) 5) Installing packages from Github: the BRRR package (SOLO, 10%] The vast majority of the time, you will install external packages using the install packages() function. This installs packages from the Comprehensive R Archive Network (CRAN), where most packages are published. But you can also install packages that are under development or haven't been published to CRAN yet. Most of the time, these packages are hosted on GitHub - an online platform for sharing code (it's also where all of the files that make up this website are stored) To install a package from GitHub, you first need to install the remotes package. Then you can use the remotest install_github() function to install packages directly from GitHub. To try this out, install the remotes package, then trying installing the BRRR package rentes install ithub ("brooke-watson/BR) Note: Packges on GitHub are in development and often require other packges to work. So if you get an installation error about some other package dependency, try restarting your R session and try again. Not sure what this package does? Well, one of the other nice things about packages listed on GitHub is the authors tend to write detailed descriptions check out the GitHub page for the BRRR package. Then try using the BRRRrrrrah() function with different number arguments (turn your volume up). In the whwa channel on slack, post your favorite argument to akrrrahh() (mine is 24). 6) Turtle practice (COLLABORATIVE, 20%] Incredibentahabisance in condandmand load the makine Yanmaa MacBook Pro 6) Turtle practice (COLLABORATIVE, 20%] In case you missed the intro to the TurtleGraphics package in class, go ahead and install and load the package. You might also want to review the related lesson page and the class slides. Then complete these tasks: a. Load the TurtleGraphics package, then initiate your turtle with the turtle_init() function b. Read through the following commands (don't run them) In a code comment, type a description of what you think the turtle is going to do turtle sota turtle move distance - 25, direction - torward turtle_move distance - 50, direction - backward) turtle rest turtle turn(angle - 30 direction right turtle move(istance - 25, direction - forward turtle dove distance - 50, direction - backward) turtle rest) c. Now run the above commands to check if the turtle did what you expected. Congratulations, you've just practiced "code tracing" Reading through code before running it then comparing the result with your expectation is an excellent method for improving your your computational thinking skills and your fluency with a particular language d. Using what you've learned about how to manipulate your turtle, write two different solutions for producing the following image (hint the length of one side of the square is 50 units)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administration The Complete Guide To Dba Practices And Procedures

Authors: Craig S. Mullins

2nd Edition

0321822943, 978-0321822949

More Books

Students also viewed these Databases questions

Question

What is the critical value of the test?

Answered: 1 week ago

Question

Question Can plan participants borrow from a VEBA?

Answered: 1 week ago

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago