DR - Racket Tutorial 1
DR - Racket 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)
(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
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.
7) Calculate the volume of a cylinder which has a base radius of 3.2 and a height of 10.1
8) Calculate the surface area of the same cylinder. (without the bases)
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