0% found this document useful (0 votes)
80 views

Tutorial 1

This document provides 8 tutorials for writing basic programs in various programming languages. The programs cover printing name and details, declaring and assigning variables, temperature conversion, currency conversion, calculating averages, sales tax calculation, calorie counting from cookie consumption, and calculating a test score average.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
80 views

Tutorial 1

This document provides 8 tutorials for writing basic programs in various programming languages. The programs cover printing name and details, declaring and assigning variables, temperature conversion, currency conversion, calculating averages, sales tax calculation, calorie counting from cookie consumption, and calculating a test score average.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Tutorial 1

1. Write a program that prints your name, age and address.


2. Write a program that declares the following:

String variable named name

int variable named age

double variable named annualPay

Store your age, name, and desired annual income as literals in these variables.
The program should display these values on the screen in a manner similar to
the following:

My name is Joe Mahoney, my age is 26 and I hope to earn $100000.0 per year.

3. Write a program to convert the temperature 53C into farenheit.


4. Write a program to convert 300o into Euros
5. Write a program that asks the user to enter the marks for English, Mathematics and
Computer Science. Display the average marks of the user.

6. Write a program that will ask the user to enter the amount of a purchase. The
program should then compute the state and county sales tax. Assume the state
sales tax is 4 percent and the county sales tax is 2 percent. The program should
display the amount of the purchase, state sales tax, county sales tax, total sales
tax, and total of the sale (which is the sum of the amount of purchase plus the
total sales tax).

7. A bag of cookies holds 40 cookies. The calorie information on the bag claims
that there are 10 servings in the bag and that a serving equals 300 calories.
Write a program that lets the user enter the number of cookies he or she
actually ate and then reports the number of total calories consumed.

8. Write a program that asks the user to enter three test scores. The program
should display each test score, as well as the average of the scores.

You might also like