## Description

Problem 1 [15pts]. Write a program that computes the slope of a line given two of its

points on the plane. In more detail, the program reads (from keyboard) two points p =

(xp, yp) and q = (xq, yq), and computes the slope m of the line that crosses p and q using the

following formula

m =

yq − yp

xq − xp

.

You program should first check to see if xq = xp in which case it should print ”The line is

vertical!” Below are two examples of how the program should behave

Example 1:

Enter the x-value of the first point: 3

Enter the y-value of the first point: 10

Enter the x-value of the second point: 7

Enter the y-value of the second point: 20

The slope of this line is 2.5

Example 2:

1

Enter the x-value of the first point: 22

Enter the y-value of the first point: 10

Enter the x-value of the second point: 22

Enter the y-value of the second point: 20

The line is vertical!

Note that you must compute the slope as a floating-point number.

Problem 2 [20pts]. Write a program that inputs the name, quantity, and price of three

items. The name may contain spaces. Output a bill with a tax rate of %6.25. All prices

should be output to two decimal places. The bill should be formatted in columns with 30

characters for the name, 10 characters for the quantity, 10 characters for the price, and 10

characters for the total. Sample input and output are shown as follows:

Input name of item 1:

lollipops

Input quantity of item 1:

10

Input price of item 1:

0.50

Input name of item 2:

diet soda

Input quantity of item 2:

3

Input price of item 2:

1.25

Input name of item 3:

chocolate bar

Input quantity of item 3:

20

Input price of item 3:

0.75

Your bill:

Item Quantity Price Total

lollipops 10 0.50 5.00

diet soda 3 1.25 3.75

chocolate bar 20 0.75 15.00

Subtotal 23.75

6.25 percent sales tax 1.48

Total 25.23

2