Lab 11-15-23
.docx
keyboard_arrow_up
School
Wayne State University *
*We aren’t endorsed by this school
Course
1500
Subject
Computer Science
Date
Jan 9, 2024
Type
docx
Pages
4
Uploaded by MateCrown15967
Lab 11-15-23
There are 4 pages.
For due date, see CANVAS
Problem One
Design a program similar to the one shown in Appendix A.
It should be
a program that solves a small problem, such as calculating a tip based
upon service. Use a multi-tiered nested “if/ else if/ then” procedure
flow.
Lay it out VISUALLY using the following icons:
Code it, compile it, execute it, and copy/paste the code and output
HERE.
Comment your code!!
Problem Two
1
In Appendix B, we see the same solution in “A,” except B uses concepts
of OOP.
Your task is to emulate the OOP style of ‘B,’ and re-design your problem
1 in terms of OOP, using ‘B’ as an example.
Lay it out visually as you did in problem 1.
2
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
Related Questions
Java - Painting a Wall
arrow_forward
Hands-On Activity 4-4
BuzzButtons is a novelty item company manufacturing personalized
lapel buttons that buzz randomly. The buttons are marketed as a
conversation starter, and the company's slogan is "It starts the buzz!"
The owner is promoting his buttons by offering them at 99 cents
each. He wants you to design a program asking the user for his or her
name for the button, an e-mail address, and the number of buttons to
order. The program should then add a 6% sales tax and a flat shipping
rate of $2.00. The program displays the information the user enters
as well as the button price total, sales tax amount, shipping amount,
and order total. The company contacts the user by e-mail later for
shipping address information.
Using pseudocode, design an algorithm that asks the user for the
number of fixed-price items to order, adds sales tax and flat-rate ship-
ping, and displays the result. Save your pseudocode file in Notepad as
buzzButtons.txt.
arrow_forward
MSIT 501/BMME 8050 Project #1 Description: You are working for a carpeting and flooring company. You need a program to create an estimate for customers. There are three types of rooms that customers might have: square, rectangle and circle. Yes, some people have houses with rooms that are circles. The program should ask for the customer’s name and address. Then ask for the dimensions of the room, in feet. It should then determine the cost to put flooring in the room. We compute flooring based upon the area of the room in square feet. Flooring material costs $2.00 per square feet and installation costs $1.50 per square foot. The equations for calculating the square footage of rooms are as follows: • Square: area = side1 ^ 2 • Rectangle: area = side1 * side2 • Circle: area = radius ^ 2 * pi Once the user has entered the information, the program should print out the customer information. Then it should print the total square feet in the room followed by the estimate for the materials and…
arrow_forward
Design and write a Python program for exercise #19:
Please label your steps with comments (#) on your program
arrow_forward
INFS3410
Practice Questions
Chapters 1, 2 and 3
The Following is an example run of an educational program for
school children. The program help kids to practice their
additions and subtraction skills.
Your task is to develop a program that can achieve the same
exact thing. Bear in mind the following important guidelines:
- The user may choose between additions and subtractions
- The user may choose the difficulty level (easy, medium,
hard)
- The program should display 5 questions and calculate the
total score
- No two questions should be the same
Please enter your name: Hafedh AlShihi
**************
Hello Hafedh AlShihi
Welcome to our Additions / Subtractions
Practice
****k*********
Which operation you want to practice? Type
1 for Additions, or Type 2 for
subtractions: 2
Please select your difficulty level
Type 1 for Easy (numbers 1 to 10)
Type 2 for Medium (numbers 10 to 100)
Type 3 for Hard (numbers 100 to 1000)
1
Here are 5 easy-level subtraction
questions, please attempt all:
How…
arrow_forward
Python task:
Task OverviewYour task is to implement a variation of the classic word game Hangman, which involves playersguessing the letters in a word chosen at random with a finite number of guesses. While there arealternate versions such as category Hangman and Wheel of Fortune, which involve playersguessing idioms, places, names and so on, we will be sticking with the traditional version.If you are unfamiliar with the rules of the game, please read the following before starting:http://en.wikipedia.org/wiki/Hangman_(game). You can also play an online version here. Don’tbe intimidated - You’ll be given some skeleton code to get you started, it's easier than it looks!
You will implement a function called main that allows users to play an interactive hangman gameagainst the computer. The computer should pick a word, and players should then try to guess lettersin the word until they win or run out of guesses.Here is the overarching behaviour we expect:1. The program should load a list of…
arrow_forward
Python question
Application: Python Fragment Formulation (Q1 – Q4)
In this group of questions you are asked to produce short pieces of Python code. When you are asked to "write a Python expression" to complete a task, you can either give the expression in one line or break down the task into several lines. The last expression you write must represent the required task.
Question 1 (Reduce parentheses)
Give an equivalent version of this expression by removing as many redundant parentheses as possible, without expanding the brackets or simplifying.
(x**(2**y))+(y*((z+x)**3))
Question 2 (Translate arithmetic concept into Python)
You are given a list of numbers, named numbers, containing 3 integers. Write a python expression (one line) that evaluates to True if and only if the product of any two numbers in the given list is greater than the sum of all three numbers.
Note: the product of two numbers, x and y is x*y.
Question 3 (List/table access)
You are given a table,…
arrow_forward
Computer science
arrow_forward
Python solution please
Task 1
Description
let's consider a case when you need a lot of coffee. Maybe you're hosting a party with a lot of guests! In these circumstances, it's better to make preparations in advance.
So, we will ask a user to enter the desired amount of coffee, in cups. Given this, you can adjust the program by calculating how much water, coffee, and milk are necessary to make the specified amount of coffee.
Of course, all this coffee is not needed right now, so at this stage, the coffee machine doesn't actually make any coffee yet.
Objectives
Let's break the task into several steps:
First, read the numbers of coffee drinks from the input.
Figure out how much of each ingredient the machine will need. Note that one cup of coffee made on this coffee machine contains 200 ml of water, 50 ml of milk, and 15 g of coffee beans.
Output the required ingredient amounts back to the user.
Examples
The greater-than symbol followed by space (> ) represents the user input.…
arrow_forward
Problem Solving Technique
Also known as Software Development Methodology. Involved six essential steps in program development. Helps in producing the output needed within the given timeline.
The first three steps are very critical in problem development.
PROBLEM
You are a System Developer in a hospital. You are to help the front desk in developing a program that reads and displays the age of 20 people (one after another) in sequence.
Hint: You need a way to count how many people whose age have been read and displayed. Therefore, you can used a concept of counter, a variable used to count the number of people whose age have been processed by the program.
From the problem below, Analyse STEP 1 until STEP 3. Follow the Problem above. For STEP 3 Please write both Flow Chart and Pseudo Code.
STEP 1: Specify the problem requirement
STEP 2: Analyze the problem
STEP 3: Design the algorithm to solve the problem
Flowchart
Pseudo Code
arrow_forward
flow chart and dimple program. Python thank you
arrow_forward
python language : complete the formula
COde with comments and output screenshot is must. No plagarism please
arrow_forward
python
The intent of this program is to manage a set of contacts. Each contact will have data associated with it:
Id – number/integer
First Name – string
Last Name – string
Age – number/integer
Phone Number – string
Email – string
Anything else you’d like to add to make yours unique (can result in extra credit)
Gender – character or string (m/f/o)
Twitter ID, Facebook Id, etc
You must allow the customer to do the following actions on the contact list:
List all contacts
Add contact
Delete contact
Edit contact
Exit program
You should leverage a database (PostgreSQL) to save everything to the DB and read from it.
You should use classes for this assignment. This means you should have two classes:
Contact – all the attributes/properties described above with appropriate constructor. Methods:
Add (constructor - __init__(p_id, p_fname, p_lname, p_age, p_phone, p_email, p_gender)
Edit
Contact List (contact_list) – built on Python list (or creating one within the constructor), you…
arrow_forward
Python Turtle Graphics
Draw a spiral diagram using Python turtle package program follows 3 steps:
Import the turtle module
Create a turtle to control.
Draw around using the turtle methods.
You should consider the following points in your solution:
The shapes should be drawn with the shown colors
Yellow and white for the square-like shapes.
Blue for the background.
The prompt should have a turtle shape.
The number of iterations should be 300
You should use only one loop.
The number of the yellow color lines should be 200.
The final shape of the output should be as shown in the picture attached.
Make sure to set properly the starting position (x & y) of your drawing, to maintain the required diagram.
video on youtube:
https://www.youtube.com/watch?v=ZqoJD2RMu1I
arrow_forward
USER REQUIREMENTS:
1. Create a new project and name it pa2_-
2. Use the loop control structures that we have discussed in writing this program.
3. Write a program that guesses your favorite number. The user is given three (3)
chances to guess your number.
4.
If he guessed it right, display the message "Congratulations! You guessed it
right!" If the user is incorrect with his guess, give him a hint if the number he
entered is higher or lower than your favorite number.
5. If the user was not able to guess your number within three tries, you may ask him
to try and guess again.
6. See sample output below.
SAMPLE OUTPUT:
Guess my number: 8
Your guess is lower than my number.
Guess my number: 15
Your guess is higher than my number.
Guess my number: 11
Congratulations! You guessed it right!
arrow_forward
Python F7
arrow_forward
Happy Numbers
Programming challenge description:
A happy number is defined by the following process.
Starting with any positive integer, replace the number by
the sum of the squares of its digits, and repeat the process
until the number equals 1 (where it will stay), or it loops
endlessly in a cycle which does not include 1. Those
numbers for which this process ends in 1 are happy
numbers, while those that do not end in 1 are unhappy
numbers.
Input:
Your program should read lines of text from standard
input. Each line contains a single positive integer, N.
Output:
If the number is a happy number, print 1 to standard
output. Otherwise, print 0.
1 process.stdin.resume();
2 process.stdin.setEncoding('utf8');
3
4 let stdin = '';
5 process.stdin.on('data', (chunk) => {
stdin = '$(stdin)${chunk}";
7)).on('end', () => {
6
9
8 const lines = stdin.trim().split('\n');
for (const line of lines) {
process.stdout.write('$(line)\n');
10
11
}
12 });
13
H
> Test Case Output
&
G
e
arrow_forward
python
arrow_forward
Basic output with variables
This zyLab activity prepares a student for a full programming assignment. Warm up exercises are typically simpler and worth fewer points than a full programming assignment, and are well-suited for an in-person scheduled lab meeting or as self-practice.
A variable like user_num can store a value like an integer. Extend the given program as indicated.
Output the user's input.
Output the input squared and cubed. Hint: Compute squared as user_num * user_num.
Get a second user input into user_num2, and output the sum and product.
Note: This zyLab outputs a newline after each user-input prompt. For convenience in the examples below, the user's input value is shown on the next line, but such values don't actually appear as output when the program runs.
Enter integer: 4 You entered: 4 4 squared is 16 And 4 cubed is 64 !! Enter another integer: 5 4 + 5 is 9 4 * 5 is 20
arrow_forward
Using python language, make a program (refer to the image).
arrow_forward
Task 1
Description
let's consider a case when you need a lot of coffee. Maybe you're hosting a party with a lot of guests! In these circumstances, it's better to make preparations in advance.So, we will ask a user to enter the desired amount of coffee, in cups. Given this, you can adjust the program by calculating how much water, coffee, and milk are necessary to make the specified amount of coffee.Of course, all this coffee is not needed right now, so at this stage, the coffee machine doesn't actually make any coffee yet.
Objectives
Let's break the task into several steps:First, read the numbers of coffee drinks from the input.Figure out how much of each ingredient the machine will need. Note that one cup of coffee made on this coffee machine contains 200 ml of water, 50 ml of milk, and 15 g of coffee beans.
Output the required ingredient amounts back to the user.ExamplesThe greater-than symbol followed by space (> ) represents the user input. Notice that it's not the part of the…
arrow_forward
PuTTY/Ocelot
Assignment #2 Instructions: (using C language in the UNIX environment, Systems Programming)
Through this programming assignment, the students will learn to do the following:
Usage: mortgagepmt [-s] -r rate [-d downpayment] price
In this assignment, you are asked to perform a mortgage payment calculation. All information needed for this will be passed to the program on the command line. There will be no user input during the execution of the program
You will need a few pieces of information. The price of the home and the amount of the down payment. You will also need to know the interest rate and the term of the mortgage. To figure your mortgage payment, start by converting your annual interest rate to a monthly interest rate by dividing by 12. Next, add 1 to the monthly rate. Third, multiply the number of years in the term of the mortgage by 12 to calculate the number of monthly payments you'll make. Fourth, raise the result of 1 plus the monthly rate to the…
arrow_forward
Instructions
The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly.
An example of the program is shown below:
Enter an integer >> 13 Enter a second integer >> 24 Enter a third integer >> 101 The sum of 13 and 24 is 37 The sum of 24 and 101 is 125 The sum of 13 and 101 is 114 The difference between 13 and 24 is -11 The difference between 24 and 101 is -77 The difference between 13 and 101 is -88
Task 1: The DebugThree3 class compiles without error.
Task 2: The add() method adds two integers.
Task 3: The subtract() method subtracts two integers.
Task 4: The DebugThree2 program accepts user input and displays the correct output.
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Related Questions
- Java - Painting a Wallarrow_forwardHands-On Activity 4-4 BuzzButtons is a novelty item company manufacturing personalized lapel buttons that buzz randomly. The buttons are marketed as a conversation starter, and the company's slogan is "It starts the buzz!" The owner is promoting his buttons by offering them at 99 cents each. He wants you to design a program asking the user for his or her name for the button, an e-mail address, and the number of buttons to order. The program should then add a 6% sales tax and a flat shipping rate of $2.00. The program displays the information the user enters as well as the button price total, sales tax amount, shipping amount, and order total. The company contacts the user by e-mail later for shipping address information. Using pseudocode, design an algorithm that asks the user for the number of fixed-price items to order, adds sales tax and flat-rate ship- ping, and displays the result. Save your pseudocode file in Notepad as buzzButtons.txt.arrow_forwardMSIT 501/BMME 8050 Project #1 Description: You are working for a carpeting and flooring company. You need a program to create an estimate for customers. There are three types of rooms that customers might have: square, rectangle and circle. Yes, some people have houses with rooms that are circles. The program should ask for the customer’s name and address. Then ask for the dimensions of the room, in feet. It should then determine the cost to put flooring in the room. We compute flooring based upon the area of the room in square feet. Flooring material costs $2.00 per square feet and installation costs $1.50 per square foot. The equations for calculating the square footage of rooms are as follows: • Square: area = side1 ^ 2 • Rectangle: area = side1 * side2 • Circle: area = radius ^ 2 * pi Once the user has entered the information, the program should print out the customer information. Then it should print the total square feet in the room followed by the estimate for the materials and…arrow_forward
- Design and write a Python program for exercise #19: Please label your steps with comments (#) on your programarrow_forwardINFS3410 Practice Questions Chapters 1, 2 and 3 The Following is an example run of an educational program for school children. The program help kids to practice their additions and subtraction skills. Your task is to develop a program that can achieve the same exact thing. Bear in mind the following important guidelines: - The user may choose between additions and subtractions - The user may choose the difficulty level (easy, medium, hard) - The program should display 5 questions and calculate the total score - No two questions should be the same Please enter your name: Hafedh AlShihi ************** Hello Hafedh AlShihi Welcome to our Additions / Subtractions Practice ****k********* Which operation you want to practice? Type 1 for Additions, or Type 2 for subtractions: 2 Please select your difficulty level Type 1 for Easy (numbers 1 to 10) Type 2 for Medium (numbers 10 to 100) Type 3 for Hard (numbers 100 to 1000) 1 Here are 5 easy-level subtraction questions, please attempt all: How…arrow_forwardPython task: Task OverviewYour task is to implement a variation of the classic word game Hangman, which involves playersguessing the letters in a word chosen at random with a finite number of guesses. While there arealternate versions such as category Hangman and Wheel of Fortune, which involve playersguessing idioms, places, names and so on, we will be sticking with the traditional version.If you are unfamiliar with the rules of the game, please read the following before starting:http://en.wikipedia.org/wiki/Hangman_(game). You can also play an online version here. Don’tbe intimidated - You’ll be given some skeleton code to get you started, it's easier than it looks! You will implement a function called main that allows users to play an interactive hangman gameagainst the computer. The computer should pick a word, and players should then try to guess lettersin the word until they win or run out of guesses.Here is the overarching behaviour we expect:1. The program should load a list of…arrow_forward
- Python question Application: Python Fragment Formulation (Q1 – Q4) In this group of questions you are asked to produce short pieces of Python code. When you are asked to "write a Python expression" to complete a task, you can either give the expression in one line or break down the task into several lines. The last expression you write must represent the required task. Question 1 (Reduce parentheses) Give an equivalent version of this expression by removing as many redundant parentheses as possible, without expanding the brackets or simplifying. (x**(2**y))+(y*((z+x)**3)) Question 2 (Translate arithmetic concept into Python) You are given a list of numbers, named numbers, containing 3 integers. Write a python expression (one line) that evaluates to True if and only if the product of any two numbers in the given list is greater than the sum of all three numbers. Note: the product of two numbers, x and y is x*y. Question 3 (List/table access) You are given a table,…arrow_forwardComputer sciencearrow_forwardPython solution please Task 1 Description let's consider a case when you need a lot of coffee. Maybe you're hosting a party with a lot of guests! In these circumstances, it's better to make preparations in advance. So, we will ask a user to enter the desired amount of coffee, in cups. Given this, you can adjust the program by calculating how much water, coffee, and milk are necessary to make the specified amount of coffee. Of course, all this coffee is not needed right now, so at this stage, the coffee machine doesn't actually make any coffee yet. Objectives Let's break the task into several steps: First, read the numbers of coffee drinks from the input. Figure out how much of each ingredient the machine will need. Note that one cup of coffee made on this coffee machine contains 200 ml of water, 50 ml of milk, and 15 g of coffee beans. Output the required ingredient amounts back to the user. Examples The greater-than symbol followed by space (> ) represents the user input.…arrow_forward
- Problem Solving Technique Also known as Software Development Methodology. Involved six essential steps in program development. Helps in producing the output needed within the given timeline. The first three steps are very critical in problem development. PROBLEM You are a System Developer in a hospital. You are to help the front desk in developing a program that reads and displays the age of 20 people (one after another) in sequence. Hint: You need a way to count how many people whose age have been read and displayed. Therefore, you can used a concept of counter, a variable used to count the number of people whose age have been processed by the program. From the problem below, Analyse STEP 1 until STEP 3. Follow the Problem above. For STEP 3 Please write both Flow Chart and Pseudo Code. STEP 1: Specify the problem requirement STEP 2: Analyze the problem STEP 3: Design the algorithm to solve the problem Flowchart Pseudo Codearrow_forwardflow chart and dimple program. Python thank youarrow_forwardpython language : complete the formula COde with comments and output screenshot is must. No plagarism pleasearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT