郭日僑華

(a) Write down the constaints of x

and y.

or

x+y ✓ 25

2x+5y < 100

(b) Express Pin terms of x and y.

-2x+y * 40

x > 0

六期星日九月二十(九八九一年八十七國民葦中

X > 0, y > 0

12x+5y > 60

7x+10y70.

x, y are integers

風南斗北 日

find

Y 20

graphically the values of x and

(c)

(ii) The profit is $(11x+18y). (b) (i)

(33)日二十月一十年日己曆夏

1990 中學會考預習專欄

明德出版社-

MILL & DALE PRESS

Mathematics (10)

(a) How many bays of each should be

prepare.

(b) What is the greatest profit?

4. There are two types of buses, A and B for hire. The rent on each bus A is $80, and on each bus B is $60. The capacity of each bus is given by the table below:

(c) On the graph provided,

**

(d) Find the value of P.

Exercise 10 Linear programming

W. K. Lo

Bus A

People

36

Luggage

40-

Solutions

140 kg

1. (a) 100-X + }

30

Bus B

15

200 kg

= 100 - (x-y)

1. (a) Maximize

100-x+y under

the

constraints

x > 2

In

x 10

32

ye

(b) Minimize 100-(x+y) under

constraints.

x: > 3

X < 8

y> 5

there cre school picnic, # altogether 180 students and 1400 kg of luggage. if the most economical way is to hire x bus A and y bus B. (a) Write down the cost in terms of

x and y.

the

10

(b) Write down the constraints for

x and y.

(c) Give

the

solution of the constraints graphically by using the graph provided below.

5

Y

Y 12

X. y are integers.

2. A farmer has 25 acres of land, $1000 capital and 120 man-days of labour to prepare for two crops A and B. The cost per acre for sowing crop A Is $20 and for crop. B is 350. Crop A takes 6 man-days per cre while crop B takes. 3 nan-days per acre. The profit on crop A.is $11 per acre and that on crop # is $18 per acre. The farmer speet x acre for crop A and y acre for crop. 8.

(a)(i) Write down the constraints in terms of x and y.

(ii) Write down the profit in

terms of x and y.

(bUsing the graph provided below,

find

(1) the values of x and y if he

wants to have maximum profit. (ii) the maximum profit.

30

20-

10

20

30

40%

104

(d) What are the values of x and y?

(e) What is the cost?

Pach

5. The following table gives the amount f

of Vitamins A, kilogramme(kg) of food

Vitamin A Vitamin B Vitamin C

Food X

3

10

Food Y

5

The minimum amount of Vitamins A, 8 and C required per week arc

(6.5,16.5)

20-

10

10

20

30

10-

y=2

From the graph,

x = 8.5

y = 16.5 (Note: Accurate calculation

gives x = y = 16)

(d) From the graph,

x=3, y=6

(Ans.)

(e) The cost

10

19 x

(ii) The maximum profit.

= 80(3) + 60(6) = $600

{Ans.)

The minimum value of x-y under

= 11(8.5) + 18(16.5) = $390.5

(Ans.)

the constraints

# (2) - (8)

-5

The maximum value of 100-(x-y)

3. (a) Let x bags of X and y bags of Y

are prepared.

5. (a) The constraints are

x % 0

is given by

Profit = $(50x+30y)

100(-6)

= 106

(Ans.)

The constraints are

2x+4y < 50 4x+2y401 6x+5y 75

X > 0 y 20

y are integers.

y >

x+3y > 12

X+ 8

2x+y > 12

(b) P = 10x + 20y

= 10(x+2y)

y > 0 4x+12у 48 3x+3y24 10x+5y > 50

or simply

X X 0

Than

IWU

of

3. A

prepares

types Fertilizer X and Y. Each bag of X contains 2 kg of chemical A, 4 kg of chemical B and 6 kg of chemical C. Each bay of Y. contains 4 kg of chemical A, 2 kg of chemical B and 5 kg of chemical C. Each bag of X yields a profit of $50 and each bag of Y yields a profit of $30. arcant of chemicals available 50 kg of A, 40 kg of B and 75 kg. of

C.

The

15

Vitamin A

tamin B

Vitamin C

48

24

60

The cost of food X and Y are $10 per kg and $20 per kg respectively. If obtain the the cheapest way to intake is to take kg of food X and 3 kg of food per week and the cost is $P.

1990 中學會考預習專攔

Computer (10)

明出版社

MILL & DALE PRESS

The relationship between flowchart and BASIC.

(a) Sequence

2.g.

START

Program Segment

elestion

10

The maximum value of (x+y) under

the constraints

= (7) + (11) = 18

The minimum value of 100~(x+y). under the constraints

10

From the graph, x-7 and y=6.

... 7 bags of X and 6 bags of Y

should be prepared.

(Ans.)

100 - (18)

= 82

2. (a)

(i)

x+y< 25 20x+50y 1000

6x+3y $120

X 2.0

Y Q

PU

K. Choy

M

N - 4 + 2

(b) Profit

(Ans:)

= 7(50) + 6(30) →→ $530

(c)

18

10-

10x+20y=100;

16,21

衲呢?也就有特高明作袿論了。 。能不能說他是一节西点华丽的憍笛 僑附熱,但是,佔澤西行的資料似乎更多 前已有華人僑居海外,而徐福是第一位華

多不方安啊! + 亦不會有問題的,袋署全部東西出入,

個多月來的孤獨感受,一掃而空。 聖誕節的婓件-使室內美觀極了。把我兩 REUZEREK, BECH:54

毋都甚理想,美滿,只可做水喉結

,水流不出來,只有採用火攻的方法

·我也去公司班

血,稍低至兩折三折呢,所以有很多人際

(Ans.)

聲傳市

10 11 12 x

From

the graph, the optimal

solution is (6, 2)

4. (a) Cost = ${80x +

(b)

x > 0, y 2.

36x+15y 180

140x+200у 1400

are integers

Soy)

(Ans.)

* ༢ f

y 2

(Ans.)

(d) P 10(6) + (20)(2)

100

{Ans.)

NEXT 1

BASIC statement

100

REM BODY OF BUBBLE SORT

110

FOR J = 1 TO 19

120

FOR K = 1 TO-20 - J

> 0 THEY M + 1 ELSE

130

N + 2

140

150

160

.170

180

NEXT J

200

210

PRINT "THE SORTED LIST:"

220

FOR 1 TO 20

230

IF MARK(K) > MARK (K+1) THEN 170

NEXT K

TNAMES= NAMES(K) TEMP MARK(K)

NAMES(K) = NAMES(K+1) MARK(K) = MARK(K+1) NAMES(K+1)= TNAMES: MARK{K+1)= TEMP

REM PRINT THE SORTED LIST IN ORDER OF MARK

PRINT NAMES(1), MARK(1)

240

NEXT I

250 END

(d) Implementation of Counter

BASIC segment

START

INPUT sumber, X

10 INPUT "PLEASE INPUT A NUMBER "H

t = 1

10 FOR I = 1 TO 40 STEP 1

X

Y Xi

20 LET Y XA2

!NPUT

20 INPUT MARK

MARK

PRINT Y

30 PRINT "THE SQUARC OF THE

NUMBER IS" Y

30 NEXT !

SOP

40 END

Discussion:

(1) REM statements should be added whenever appropriate.

description of the following program segment is written.

The job

(2) Structural programming is a good practice. Do not use too much GOTO statements. Otherwise you may get lost in the program statements. Identation of the program makes it clear that it is a loop.

e.g.

-110

FOR 1 TO 19

120

FOR K 1 TO 20 - 3

170

180

- NEXT K NEXT J

此等引術問題,等到接任之「不幸」者,看上宮服

標 知其科生滿诚者,於是想脫;來不及矣!

張庭

(b) Unconditional Branching and Conditional Branching:

4.4.

Program Segmerit

IS

40

(e) Subroutine

START

BASIC statement

10. GOSUB 500

20

PUT

"radius"

10 INPUT "PLEASE INPUT THE

RADIUS OF CIRCLE"; R

Sorting the number in assecoding

order

500 REM BUBBLE SORT 510

20 IF R 0 THEN 60

590 RETURN

Yea

5

STOP

AREA

Programming Exercise

3.1416 x R2

30 AREA - 3.1416 R2

1. Bubble sort

Write a program in BASIC that can do the following jobs.

PRINT

MAREA", AREA

40 PRINT "AREA OF CIRCLE = ";

AREA

(a) A list of 20 names and marks are input into a

dimensional array.

two-

50 GOTO 10

60 END

(b) The list of names and marks are sorted according to the

decending order of marks.

The structure make it easy that lines between 120 and 170 is the inner loop and lines between 110 and 180 is the outer loop. No inter-crossing of loop will happen. But it is only true for most versions of BASIC but not for APPLE II user unless a set of machine code is keyed in. You are requested to use structural programming style when answering questions in the HKCEE.

(3) For students using the Commodore PC-10 model of computer. Lines

140 to 160 can be replaced by

you

140 SWAP NAMES(X), NAME${X+1) 150 SWAP MARK(K), MARK(K+1)

The SWAP function exchanges the values of two variables. However

this functionin suggested not to use are examination because it is not included in the reserved work list You are announced by the Hong Kong Examination Authority. encourage to use a wide variety of functions provided by your machine in the computer laboratory but not in the examination.

2. Using the sorted list of the student names and marks in (1). Write a subroutine program using the algorithm of linear search to look for the existence of a student and then print his mark. and position.

500

REM SUBROUTINE: LINEAR SEARCH

510

(c) The sorted list should be printed out.

520

FOR 1.1 TO 20

530

BASIC program

540

Remarks:

(1) Box 3 is the conditional branching, the branching depends on the radius as the condition. Line 20 is the corresponding BASIC statement.

10 REM INPUT OF NAMES AND MARKS

550

PRINT "MARK": MARK(I)

20 DIM NAMES(20), MARK(20)

560

30

FOR I = 1 TO 20

570

GOTO 660

40

(2) The Flowline after box 5 is the unconditional branching. Line!

50 is the corresponding BASIC statement.

50

INPUT "NAME OF STUDENT"; NAMES(1) INPUT "MARK OF STUDENT"; MARK(1)

580

NEXT I

590.

INPUT "NAME OF STUDENT TO BE SEARCH": NAS

IF NAS NAMES(I) THEN 580

PRINT "NAME OF STUDENT"; NAME$(1)

PRINT "POSITION": 1

PRINT "THE STUDENT IS NOT IN THE LIST!"

揉說卹

慈買一件大碼 然大受男人 雖然买人服 睇]·组睫 一些。

60

PRINT

660

EMD

Share This Page