Assignment 02
Assignment 02
The objective of these exercises is to read and display the five native data types (int, double,
char, bool and string). Please note that some of the problems might not have an intelligent
business purpose, but all that is necessary is to for you to read from user input from the
keyboard and display program output to the.
Data Types
COMP100 Programming Fundamentals Week 3
5. Adult ticket cost $3.75 and child ticket cost $2.25. Write a program to prompt the user for
the amount of adult and child ticket that she needs. The program will display a user-friendly
message of the number of tickets brought as well as the total cost. (Use the "C" format-
string for currency).
6. Write a program to calculate and display the potential difference between the ends of a
wire. The program will prompt the user for the current flowing and the resistance of the
wire. Potential difference is the product of the current and the resistance of the wire and
may include a fractional part. (Again, use the "F" format-specifier for floating point values).
Data Types