Week1

docx

School

Troy University, Troy *

*We aren’t endorsed by this school

Course

3320

Subject

Computer Science

Date

Dec 6, 2023

Type

docx

Pages

2

Uploaded by ProfEel3908

Report
Chaoran liu 10/26/2023 CS3320 Week 1 Assignment Chapter 1 3.How many different characters can be represented in ASCII? Name the character set that addresses this limitation. ASCII (American Standard Code for Information Interchange) is a character encoding standard that defines a set of 128 characters, including letters, digits, punctuation marks, and control characters. These 128 characters can be represented using 7 bits, which allows for a total of 2^7 (128) different characters. The 128 or 256 character limits of ASCII and Extended ASCII limits the number of character sets that can be held. Representing the character sets for several different language structures is not possible in ASCII, there are just not enough available characters. Chapter 2 8. Tip, Tax, and Total Write a program that calculates the total amount of a meal purchased at a restaurant. # get the charge for the food from the user food_charge = float(input("Enter the charge for the food: ")) # calculate the tip and tax amounts tip_amount = food_charge * 0.18 tax_amount = food_charge * 0.07 # calculate the total cost of the meal total_cost = food_charge + tip_amount + tax_amount # display the tip, tax, and total amounts print("Tip amount: $", format(tip_amount, ".2f"), sep="") print("Tax amount: $", format(tax_amount, ".2f"), sep="") print("Total cost: $", format(total_cost, ".2f"), sep="") Chapter 3 11. Book Club Points # prompt the user to enter the number of books purchased this month num_books = int(input("Enter the number of books purchased this month: "))
# determine the points earned based on the number of books purchased if num_books == 0: points = 0 elif num_books == 2: points = 5 elif num_books == 4: points = 15 elif num_books == 6: points = 30 elif num_books >= 8: points = 60 else: print("Error: Invalid number of books entered.") exit() # display the number of points earned print("You have earned", points, "points this month.") this is my former work, I have the copyright of that.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help