Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
market

Subject: market

From: Bob

Date: 12 Mar, 2012 00:42:13

Message: 1 of 2

I've got an assignment. I've already done some research but I still don't know how to solve this problem. I have to send it to my teacher in 5 hours.

I'm going to the supermarket with 100 Euro's and I have to buy exactly 100 pieces of fruit with it. I am only allowed to buy oranges, grapefruit and melons.
The function should calculate all possible outcomes after you give the prices (cents)
Note: it has to be exactly 100 euro's and 100 pieces of fruit.

function A = market (price_oranges, price_grapefruit, price_melons)

The results must be delivered in a delimited textfile.

Example. The outcome of (35,60,235) (in eurocents) should be like:
1,76,23
8,68,24
15,60,25
22,52,26
29,44,27
36,36,28
43,28,29
50,20,30
57,12,31
64,4,32

Subject: market

From: Roger Stafford

Date: 12 Mar, 2012 02:04:14

Message: 2 of 2

"Bob" wrote in message <jjjgp5$fnf$1@newscl01ah.mathworks.com>...
> I've got an assignment. I've already done some research but I still don't know how to solve this problem. I have to send it to my teacher in 5 hours.
- - - - - - -
  It looks like a good problem for a single, smart for-loop. You have three unknowns and two equations, but your solutions must be non-negative integers.

Roger Stafford

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us