[SOLVED] CSE106- Lab 1

25.99 $

Category:

Description

Rate this product
  • Write an adding program that does the following (10 points):
    1. Ask the user to enter two or more numbers separated by spaces
    2. Print the sum of all the numbers to the console
    3. Throw an error if they do not enter at least two numbers or contain a string
    4. Note: the numbers can be integers or decimals
    5. Example:
      1. The user enters: 1 2 3 4
      2. The program prints: 10
  • Write a punishment automation program in Python that does the following (15 points):
    1. Ask the user to enter a sentence and the of times the sentence should be repeated
    2. The program should write the sentence (with a line break) the number of times specified by the user to a file called “CompletedPunishment.txt”
    3. Example:
      1. The user enters this for the sentence: I will not sleep in class
      2. The user enters this for the number of repeats: 100
  • The program should write “I will not sleep in class” 100 times to “CompletedPunishment.txt”.
  • Write a word count program in Python that does the following (25 points):
    1. Prompt the user to enter a word
    2. Parse PythonSummary.txt and count the number of times the word occurs in the file
    3. Tell the user how many times the word occurs
    4. Note: It should find the word regardless of case (upper or lower) or punctuation
    5. Example:
      1. The user enters: python
      2. The program should print: The word python occurs 13 times
  • Write a class schedule formatting program that does the following (25 points):
    1. Parses “classesInput.txt” for the following info (on the corresponding line):

Line 0: Number of courses (the following data should exist for each course)

Line 1: Course department

Line 2: Course number

Line 3: Course name

Line 4: Credits

Line 5: Lecture days

Line 6: Start time of the lecture

Line 7: End time of the lecture

Line 8: Average grade (percentage) for the course

  1. Outputs a file with the data formatted as follows:

COURSE 1: <Course department><Course number>:<Course name>

Number of Credits: <Credits>

Days of Lectures: <Lecture days>

Lecture Time: <Start time> – <End time>

Stat: on average, students get <average grade> in this course

REPEAT for each additional class, up to <Number of courses>

  1. Example:

Input:

2

CSE

030

Data Structures

4

Monday, Wednesday

4:30pm

5:45pm

85

CSE

165

Introduction to Object Oriented Programming

4

Tuesday, Thursday

9:00am

10:15am 87

Output:

COURSE 1: CSE030: Data Structures

Number of Credits: 4

Days of Lectures: Monday, Wednesday

Lecture Time: 4:30pm – 5:45pm

Stat: on average, students get 85% in this course

COURSE 2: CSE165: Introduction to Object Oriented Programming

Number of Credits: 4

Days of Lectures: Tuesday, Thursday

Lecture Time: 9:00am – 10:15am

Stat: on average, students get 87% in this course