You are on page 1of 3

LAB 1: Operators

Project naming convention


 Create a project named: pLab01_Operators_ID
 With ID stands for student’s identify, p is short for project
 Ex: If your student’s ID is 9600278, so your project name will be:
pLab01_Operators_9600278
 Pay attention to “_” (underscore)
Package naming convention: Each project has one or many packages.
 Each package has a specific name
 Each Lab has one package name. Remember to name the packages as follow:
labNo_ID
 With No is a number of each lab, ID stands for student’s identify
 Ex: lab01_9600278, lab02_9600278
 Remember to use lowercase l
Class naming convention (Files): Each package has one or many classes
 Each class has a specific name
 Remember to name the classes (classname) as follow:
LabNo_ID and TestLabNo_ID
 With No is a number of each lab, ID stands for student’s identify
 Ex: Lab01_9600278, TestLab01_9600278, Lab02_9600278,
TestLab02_9600278
 Remember to capitalize each word L, T and L

1. Compute result of expression

2. Computer the area and circumference of the circle with known radius
3. Write a program that reads three numbers from the command line: a, b, c. Then
compute area of the triangle

p = (a+b+c):2
4. Compute oscillated cycle
l is length of the band that hangs oscillate (meter)
g is gravitational acceleration = 9.18 m/s2
5. The formula for resistors connected in parallel is a little more complex. Given two
resistors with resistances R1 and R2 connected in parallel the equivalent resistance
is given by the inverse of the sum of the inverses. If there are more than two
resistors you continue to invert the sum of their inverses. Write a program that
calculates the resistance of three resistors arranged in parallel

6. The equivalent resistance of resistors connected in series is calculated by adding the


resistances of the individual resistors. Write a program that accepts a series of
resistances from the command line and outputs the equivalent resistance.
7. Write a program that enters the subjects’ scores of the students in semester I and
displays their score-board as following:

****************************************************************
Fullname : ĐỖ THỊ LAN
Class : CMU CS 303 BIS - DIS
Department : CMU
School year : 2018-2019

Scores of subjects in semester one :


Computer Engineering :7 Computing 1 :7
Practical Computer :9 Software Engineering :8
English :8
****************************************************************
8. Write a program that draws the following figures
**
**
**
**
**
******
******
9. Write a program that draws the following figures
OO
OO
OO
OO
OO
OOOOOO
OOOOOO
OOOOOO

10. Write a program that draws the following figures

***** *
***** **
***** ***
***** *****

11. Write a program that enters from keyboard and displays integer, double, float, string
12. Write a program that converts a lower character to upper character (a-z to A-Z)
13. Sales tax in New York City is 8.25%. Write a program that accepts a price on the
command line and prints out the appropriate tax and total purchase price.
14. There are exactly 2.54 centimeters to an inch. Write a program that takes a number
of inches from the command line and converts it to centimeters
15. There are 454 grams in a pound and 1000 grams in a kilogram. Write programs that
convert pounds to kilograms and kilograms to pounds. Read the number to be
converted from the command line. Can you make this one program instead of two?

You might also like