Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Linear Equations in MATLAB, Exercises in Branching, Logic, Loops and Function | COMP 116, Assignments of Computer Science

Material Type: Assignment; Professor: Rewaskar; Class: Introduction to Scientific Programming; Subject: COMPUTER SCIENCE; University: University of North Carolina - Chapel Hill; Term: Unknown 1989;

Typology: Assignments

Pre 2010

Uploaded on 03/16/2009

koofers-user-45i
koofers-user-45i 🇺🇸

10 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Comp 116 Assignment 3: (Parts A, B)
Posted, May 25
th
Due Friday, June 1
st
PART A: LINEAR EQUATIONS in MATLAB
In this assignment we will solve systems of linear equations to answer questions about currency
exchange rates.
1. Calculating Exchange Rates
Your goal is to come up with exchange rate for each of 5 foreign currencies:
Euro, Canadian Dollar, British Pound, Australian Dollar, Swiss Franc
[10 points] Build a system of 5 equations with 5 unknowns to compute the value of one $US in each of
the foreign currencies given the following constraints:
100 Euro + 100 Swiss Francs = $200
200 British Pounds = 100 Euro + 300 Swiss Francs
200 Can. Dollars + 200 Aus. Dollars = $325
100 Euro + 300 Aus. Dollars + 300 Swiss Francs = $580
200 Euro + 300 Can. Dollar + 500 British Pounds + 700 Aus. Dollars = $1920
[5 points] Use MATLAB to solve the system of equations from the previous part.
[5 points] What is the value in $US of 100 Canadian Dollars + 200 British Dollars + 300 Australian
Dollars?
[5 points] What is the value of $100 US in each of the foreign currencies? Give your answer as a
number, and also as a bar chart. You can use the MATLAB command bar to produce this chart.
2. Conversion with a Surcharge
The bank offers two options for converting US $ into Euros.
A) Convert at the published rate (the answer to part 1) and then pay a 3 Euro fee.
B) Convert at 98% of the published rate without paying a fixed surcharge.
[5 points] Suppose that you have ten $50 bills that you take to the bank to be exchanged. To decide how
much to convert, and which conversion plan is better, create a plot. The plot will have $US on the x-axis
and Euro on the y-axis. Plot two graphs, one showing the conversion under the Plan A and second
showing the conversion under Plan B. The plot should include a legend and be formatted so that the two
graphs can be differentiated in print (i.e. black and white printout).
Which plan is best if I want to convert all $500?
What if I only want to convert $40?
Explain why
.
pf3

Partial preview of the text

Download Linear Equations in MATLAB, Exercises in Branching, Logic, Loops and Function | COMP 116 and more Assignments Computer Science in PDF only on Docsity!

Comp 116 Assignment 3 : (Parts A, B)

Posted, May 25th Due Friday, June 1st

PART A: LINEAR EQUATIONS in MATLAB

In this assignment we will solve systems of linear equations to answer questions about currency exchange rates.

  1. Calculating Exchange Rates Your goal is to come up with exchange rate for each of 5 foreign currencies: Euro, Canadian Dollar, British Pound, Australian Dollar, Swiss Franc

[10 points] Build a system of 5 equations with 5 unknowns to compute the value of one $US in each of the foreign currencies given the following constraints: 100 Euro + 100 Swiss Francs = $ 200 British Pounds = 100 Euro + 300 Swiss Francs 200 Can. Dollars + 200 Aus. Dollars = $ 100 Euro + 300 Aus. Dollars + 300 Swiss Francs = $ 200 Euro + 300 Can. Dollar + 500 British Pounds + 700 Aus. Dollars = $

[5 points] Use MATLAB to solve the system of equations from the previous part.

[5 points] What is the value in $US of 100 Canadian Dollars + 200 British Dollars + 300 Australian Dollars?

[5 points] What is the value of $100 US in each of the foreign currencies? Give your answer as a number, and also as a bar chart. You can use the MATLAB command bar to produce this chart.

  1. Conversion with a Surcharge The bank offers two options for converting US $ into Euros. A) Convert at the published rate (the answer to part 1) and then pay a 3 Euro fee. B) Convert at 98% of the published rate without paying a fixed surcharge.

[5 points] Suppose that you have ten $50 bills that you take to the bank to be exchanged. To decide how much to convert, and which conversion plan is better, create a plot. The plot will have $US on the x-axis and Euro on the y-axis. Plot two graphs, one showing the conversion under the Plan A and second showing the conversion under Plan B. The plot should include a legend and be formatted so that the two graphs can be differentiated in print (i.e. black and white printout).

  • Which plan is best if I want to convert all $500?
  • What if I only want to convert $40?
  • Explain why .
  1. Another System of Equations At the same bank, another customer tries to convert her European currencies into $US.

[10 points] Set up and solve a system of linear equations to find out how much of each currency this customer has.

  • All of her money is in 100 (something) bills.
  • She has 15 bills total
  • She has 3 fewer 100 Euro bills than 100 Swiss Franc and 100 British Pound bills combined.
  • She has 3 times as many 100 Euro bills as 100 Swiss Franc bills

[10 points] How much money will she get if she converts all of her money to $US if the bank gives her the exchange rate from question 1 and charges no fee.

PART B: An exercise in Branching, Logic, Loops and Functions. [50 points]

  1. Sudoku Solution Checker - ( http://en.wikipedia.org/wiki/Sudoku )

The aim of the Sudoku puzzle is to enter digits 1 to 9 in each cell of a 9× grid made up of 3×3 subgrids (called 'regions'), starting with various digits given in some cells (the "givens").

Each row, each column, and all the 3x3 block ('regions') must contain only one instance of each number.

A Sudoku puzzle and its solution: