0% found this document useful (0 votes)
21 views2 pages

DR - Racket Tutorial 1

The document outlines a tutorial for SCS1102 Programming I, presenting ten programming scenarios to be implemented in DrRacket and Python. These scenarios include arithmetic calculations, area and volume computations, profit calculations, and conversions between units. Each scenario is accompanied by the corresponding code snippets in a Lisp-like syntax.

Uploaded by

Randy Bale
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views2 pages

DR - Racket Tutorial 1

The document outlines a tutorial for SCS1102 Programming I, presenting ten programming scenarios to be implemented in DrRacket and Python. These scenarios include arithmetic calculations, area and volume computations, profit calculations, and conversions between units. Each scenario is accompanied by the corresponding code snippets in a Lisp-like syntax.

Uploaded by

Randy Bale
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

SCS1102 Programming I Tutorial 1

Tutorial 1
Implement solutions for the following scenarios using DrRacket and Python.
1) 12+4/2*7-11+9

(- (+ 12 (* 7 (/ 4 2)) 9) 11)

2) Write a program that computes XN.


XN = X * X * X * ... * X
X= 1.3
N=5

(define X 1.3)
(define N 5)
(expt X N)

3) Calculate the value of b2-4ac for 3x2-2x+1=0 (written in the format ax2+bx+c=0)

(define a 3)
(define b -2)
(define c 1)
(- (* b b) (* 4 a c))

4) Calculate the area of a disk which has a radius of 5.4 using the formula, 3.14*r2

(define radius 5.4)


(* pi radius radius)

5) Calculate the surface area of the following disk with the outer radius 7 and the inner
radius 5.

Page 1 of 2
SCS1102 Programming I Tutorial 1

(define outer 7)
(define inner 5)
(- (* pi outer outer) (* pi inner inner))

6) At ABC movie theatre, each customer pays Rs. 150, and a show costs Rs. 2000 to the
theatre and Rs. 30 per attendee. Find the profit the theatre makes with 520 attendees.

(define ticket-price 150)


(define attendees 520)
(- (* attendees ticket-price) (+ 2000 (* 30 attendees)))

7) Calculate the volume of a cylinder which has a base radius of 3.2 and a height of 10.1

(define radius 3.2)


(define height 10.1)
(* pi radius radius height)

8) Calculate the surface area of the same cylinder. (without the bases)

(define radius 3.2)


(define height 10.1)
(* 2 pi radius height)

9) Calculate the amount of minutes when given the number of years and days as user
input.
(define years (string->number(read-line)))
(define days (string->number(read-line)))
(+ (* years 365 24 60) (* days 24 60))

10) Calculate the height of a person in centimeters when given the height in feet and inches.

1 inch = 2.54 cm

1 foot = 12 in

(define feet 5)
(define inches 10)
(* (+ (* 12 feet) inches) 2.54)

Page 2 of 2

You might also like