Lab Topic 6 individual F23
.docx
keyboard_arrow_up
School
Texas A&M University *
*We aren’t endorsed by this school
Course
102
Subject
Computer Science
Date
Jan 9, 2024
Type
docx
Pages
1
Uploaded by ProfLightning103643
Lab: Topic 6 (individual)
ENGR 102
Lab: Topic 6 (individual)
Deliverables:
There are two deliverables for this individual assignment. Please submit these files to zyBooks:
howdy_whoop.py
juggler_sequence.py
Activity #1
: Howdy Whoop – individual
Write a program named
howdy_whoop.py
that takes as input from the user two positive integers.
Output the numbers 1 to 100, each on its own line, unless the number is evenly divisible by one or both
of the integers entered by the user. If the number is evenly divisible by the first integer, print
Howdy
. If
it’s evenly divisible by the second integer, print
Whoop
. If it’s evenly divisible by both, print
Howdy
Whoop
. Format your output as shown below. User input is shown in bold and red text.
Example output (using inputs
2
and
3
):
Enter an integer:
2
Enter another integer:
3
1
Howdy
Whoop
...
Whoop
Howdy
Activity #2
: Juggler sequence – individual
The Juggler sequence (
https://en.wikipedia.org/wiki/Juggler_sequence
) produces a sequence of integers
using the following procedure. Given a number
n
, if
n
is even then the next number is the floor
of the square root of
n
. If
n
is odd, then the next number is the floor of
n
3
/
2
. The Juggler
sequence ends when
n
reaches 1.
As an example, if you start with the number 7, then the terms of the sequence will be: 7, 18, 4, 2, 1.
Write a program named
juggler_sequence.py
that takes in a positive integer from the user, and
computes the Juggler sequence, printing out all the numbers in the sequence, followed by a line stating
how many iterations it took to reach the value 1. Format your output as shown below. User input is
shown in bold and red text.
Example output (using input
7
):
Enter a positive integer:
7
The Juggler sequence starting at 7 is:
7, 18, 4, 2, 1
It took 4 iterations to reach 1
Based upon Dr. Keyser’s Original
1
Revised Fall 2023 SNR
Discover more documents: Sign up today!
Unlock a world of knowledge! Explore tailored content for a richer learning experience. Here's what you'll get:
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
Latest version of NetBeans IDE
Java Development Kit (JDK) 8
Create a folder named Dahan_yoon in your local
Create a new project named LabExer5A. Set the project location to your own
The program shall:
generate a random number from 1 to 50 for a player to guess;
display a message that indicates whether the player’s guess is correct, too low, or too high; and
prompt the user to keep on guessing until the correct value is entered
Create a try-catch structure that will handle two (2) exceptions. These are when the user inputs the following:
a number that is out of range (1 – 50)
a letter or any non-numeric character
Prompt the user so that he can guess again if an exception is
Display the number of total
Note: An invalid input (when an exception is thrown) is not considered a valid guess or attempt.
arrow_forward
Create a simple program for a quiz
Software Requirements:
Latest version of NetBeans IDE
Java Development Kit (JDK) 8
Procedure:
Create a folder named LastName_FirstName (ex. Dahan yoon) in your local
Create a new project named LabExer5B. Set the project location to your own
The program shall:
contain an array of 10 multiple choice questions with three (3) choices each and
require the user to choose among A, B, or C;
Note: Cases are ignored. Lowercase letters are acceptable (a, b, c).
Create a try-catch structure to handle three (3) exceptions. These are when the user inputs the following:
an invalid letter (not A, B, or C)
a number or any special character
blank (no answer)
Prompt the user that he can answer again if any of the three (3) exceptions is
Display the score.
arrow_forward
JAVA PPROGRAM ASAP
Please Modify this program ASAP BECAUSE IT IS HOMEWORK ASSIGNMENT so it passes all the test cases.
The program must pass the test case when uploaded to Hypergrade. Also, for test cases 1-4 it wants only to input Please enter the file name or type QUIT to exit: then input the file and display the Total number of words. For test cases 5 and 7 it wants to only to input Please enter the file name or type QUIT to exit then input input5.txt and then display File: input5.txt does not exist.\n then display Please enter the file name again or type QUIT to exit:\n then type input1.txt to display the total number of words or type quit to exit the program. For test case 6 it wants only to Please enter the file name again or type QUIT to exit:\n then type quit to exit the porgram.
Chapter 9. PC #10. Word Counter (page 610)
Write a program that asks the user for the name of a file. The program should display the number of words that the file contains.
Input…
arrow_forward
Name SearchIn the Chap07 folder of the Student Sample Programs, you will find the followingfiles:• GirlNames.txt—This file contains a list of the 200 most popular names given to girls born in the United States from 2000 through 2009.• BoyNames.txt—This file contains a list of the 200 most popular names given to boys born in the United States from 2000 through 2009.Create an application that reads the contents of the two files into two separatearrays or Lists. The user should be able to enter a boy’s name, a girl’s name, orboth, and the application should display messages indicating whether the nameswere among the most popular
arrow_forward
C++HurdleWords The HurdleWords class is mostly provided to you. HurdleWords is constructed from two files in the data/ folder: ● valid_guesses.txt (all 5 letter guesses considered to be valid words to guess), and ● valid_hurdles.txt (all words that may be selected to be the secret Hurdle.) ● Note: you may edit both text files if you’d like to add custom words to your game. HurdleWords stores all potential valid Hurdles from valid_hurdles.txt into a vector of strings (valid_hurdles_), and all valid guesses from valid_guesses.txt into an unordered set of strings (valid_guesses_). A set is simply a data structure that contains no duplicates and allows for a speedy lookup to check if a given element exists within the set. Because there are over 10,000 valid guesses, we store them in an unordered set to leverage their speediness, as you will need to check if a user-submitted guess is considered valid (i.e. their guess is considered a valid guess in the dictionary). You are responsible for…
arrow_forward
Pendant Publishing edits multi-volume manuscripts for many authors. For each volume, they want a label that contains the author’s name, the title of the work, and a volume number in the form Volume 9 of 9. For example, a set of three volumes requires three labels: Volume 1 of 3, Volume 2 of 3, and Volume 3 of 3. Design an application that reads records that contain an author’s name, the title of the work, and the number of volumes. The application must read the records until eof is encountered and produce enough labels for each work. The flowchart must include a call symbol, at the beginning, to redirect the input to the external data file.
create a solution algorithm using pseudocode
create a flowchart using RAPTOR
arrow_forward
Pendant Publishing edits multi-volume manuscripts for many authors. For each volume, they want a label that contains the author’s name, the title of the work, and a volume number in the form Volume 9 of 9. For example, a set of three volumes requires three labels: Volume 1 of 3, Volume 2 of 3, and Volume 3 of 3. Design an application that reads records that contain an author’s name, the title of the work, and the number of volumes. The application must read the records until eof is encountered and produce enough labels for each work. Design a flowchart and psuedocode Pendant Publishing.
arrow_forward
Fix the errors in the Customer class and the Program.
DATA FILE
ThinkAbout Tech
344 Park Ave, NY, NY 10022
Kemp Technologies
3601 Broadway, NY, NY 10021
Verizon 6 Hudson Street, NY, NY 10001
Merrill Lynch
7 World Financial Center, NY, NY 10001
Philips Laboratories
345 Scarborough Rd, Briarcliff Manor, NY 10510
CODE
#include <iostream>
#include <fstream>#include <string>using namespace std;
class Customer { // Constructorvoid Customer(string name, string address) : cust_name(name), cust_address(address){acct_number = this.getNextAcctNumber();}
// Accessor to get the account numberconst int getAcctNumber() { return acct_number; }
// Accessor to get the customer namestring getCustName(} const { return cust_name; }
// Accessor to get the customer addressstring getCustAddress() const { return cust_address; }
// Set a customer name and addressstatic void set(string name, string address);
// Set a customer addressvoid setAddress(string cust_address) { cust_address =…
arrow_forward
Finish this program from the code posted below! Note: There should be two files Main.py and Contact.py
You will implement the edit_contact function. In the function, do the following:
Ask the user to enter the name of the contact they want to edit.
If the contact exists, in a loop, give them the following choices
Remove one of the phone numbers from that Contact.
Add a phone number to that Contact.
Change that Contact's email address.
Change that Contact's name (if they do this, you will have to remove the key/value pair from the dictionary and re-add it, since the key is the contact’s name. Use the dictionary's pop method for this!)
Stop editing the Contact
Once the user is finished making changes to the Contact, the function should return.
Code:from Contact import Contactimport pickledef load_contacts():""" Unpickle the data on mydata.dat and save it to a dictionaryReturn an empty dictionary if the file doesn't exist """try:with open("mydata.dat", 'rb') as file:return…
arrow_forward
JAVA PPROGRAM ASAP
Hypergrade does not like this program because it says 2 out of 7 passed and take out the extra \n from the program. Please Modify and change this program ASAP BECAUSE IT IS HOMEWORK ASSIGNMENT so it passes all the test cases. The program must pass the test case when uploaded to Hypergrade. Also, for test cases 1-4 it wants only to input Please enter the file name or type QUIT to exit: then input the file and display the Total number of words. For test cases 5 and 7 it wants to only to input Please enter the file name or type QUIT to exit then input input5.txt and then display File: input5.txt does not exist.\n then display Please enter the file name again or type QUIT to exit:\n then type input1.txt to display the total number of words or type quit to exit the program. For test case 6 it wants only to Please enter the file name again or type QUIT to exit:\n then type quit to exit the porgram.
import java.io.File;import java.io.FileNotFoundException;import…
arrow_forward
Using C# language please in Visual Studio 2022 in Windows Form App.
As for the folder-- for convenience sake-- create some folders and insert a couple of names in there, not 200.
arrow_forward
IN C LANGUAGE
A well-known showroom allows managers to keep track of how many appliances are available or have been sold. Ask the user to input the following information for n number of appliances in the showroom:
Code, Price, Status(Available/Sold)
Create the following files:
1. “available_appliances.txt” that displays all the information of appliances available in the showroom.
2. “sold_appliances.txt” that displays all the information of sold appliances.
arrow_forward
C# langauge. In visual studio 2022
for folders, create some folder and type a few names.
arrow_forward
Topic : Multiple Selection Control Structure
Instruction :
1. Save your java file name same as your class name in the coding. Example :
Save as : Munirah_S3BT20.java
Class name for coding : class Munirah_S3BT20
Problem Description :
Maths Tuition Centre asked you as a senior programmer to develop a Java program. The
program is to calculate the total fee to be paid for each student. Each student must pay RM10
for the learning module. Tuition centre also gives the discount based on total charge. Below
are the charge rate provided by tuition centre:
Hour
Charge
Discount
First hour
RM15 per hour
3%
Next 5 hours
RM10 per hour
7%
7 hours and above
RM5 per hour
12%
*Total fee will be granted with one-time discount only
The program will allow users to enter student's names and total hours. Then, the program will
calculate the total fees including the learning module and total charge.
Begins your code with name, class, matric number, and problem description as a comment. Use
2 decimal point…
arrow_forward
The names and student numbers of students are save in a text file called stnumbers.txt. Example of the content of the text file:
Peterson
20570856
Johnson
12345678
Suku
87654321
Westley
12345678
Venter
87654321
Mokoena
79012400
Makubela
29813360
Botha
30489059
Bradley
30350069
Manana
30530679
Shabalala
28863496
Smith
87873909
Nilsson
30989698
Makwela
30256607
Govender
30048117
Ntumba
30598303
Ramsamy
29952239
Skosana
29982995
Jameson
30228484
Xulu
29092248
Wasserman
27469352
Bester
28615425
Babane
27154033
Maboya
29897890
Mahlangu
30031338
Majavu
30165970
Myene
30954177
Motaung
30907276
Ramaroka
30804507
Radebe
30007674
Sekake
30017416
Zwane
30038227
Shuro
30238072
Viljoen
28881389
Sithole
45688555
Write a function called displayData() to receive the array and number of elements as parameters and display the names and student numbers of the students with a heading and neatly spaced.
Write a function, isValid(), which receives a number as parameter and determines whether the number…
arrow_forward
O 0{ 48%
4G*
VodaCom-SA ll
2:3
|_DO_SU1
CMPG 122
User Interface Programming
I_Do
Chapter 2: Introduction to Visual C#
1. Books and Authors (Pg. 130 - 131)
Look at the following list of some famous books and their authors.
Books
Authors
Margaret Mitchel
Alex Haley
Ayn Rand
Gone with the Wind
Roots
Atlas Shrugged
Create an application that gives the authors' name for a particular book. The form should
have three labels, one for each book. When the user clicks a button, the application
should display the name of its author in another Label control.
arrow_forward
In CPP:
Monthly Sales
Create a program that allows you to view and edit the sales amounts for each month of the current year.
Console
Monthly Sales program
COMMAND MENU
view - View sales for specified month
edit - Edit sales for specified month
totals - View sales summary for year
exit - Exit program
Command: view
Three-letter Month: jan
Sales amount for Jan is 14,317.00.
Command: edit
Three-letter Month: jan
Sales Amount: 15293
Sales amount for Jan is 15,293.00.
Command: totals
Yearly total: 77,786.71
Monthly average: 6,482.23
Command: view
Three-letter Month: july
Invalid three-letter month.
Command: exit
Bye!
Specifications
The program should use a map to store the sales data for each month with the three-letter abbreviation for the month (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, and Dec) as the key for each item.
When the program starts, it should read the sales data inserted from the user.
If the user edits the sales data, the…
arrow_forward
Language in C# using Visual Studio in Windows Form app please.
For the name files, just create a text file that has a few names for your time sake.
arrow_forward
Searching for a student’s details and status. from this pseudocode
startdeclarationsnum studentNumnum studentTempnum numOfStudentsnum maxOfStudents = 300num timeOfDaynum maxTemp = 38 degreesnum studentNumArray (maxStudents)String studentNameString studentStatusstring nameArray (maxStudents)string QUIT "ZZZ"while numOfStudents < maxStudentswhile quit <> "ZZZ" studentScreening()tempMonitor()timeMonitor()studentArray()numOfStudents = numOfStudents + 1studentSearchDetails()endwhileendwhilestop
studentScreening()output "Enter student number"input studentNumoutput "Enter student name"input studentNameoutput " Student Temp"input studentTempoutput "Enter time"input "time"returntempmonitor()if studentTemp >maxTemp = 38 degreesoutput studentStatus = "Not Admitted"status = Not Admittedelsestatus = Admittedoutput studentStatus = "Admitted"end ifreturntimeMonitor()output "Enter Time of Screening"input timeOfDayif timeOfDay > 12status = "Not Admitted"output studentStatus =…
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Related Questions
- Latest version of NetBeans IDE Java Development Kit (JDK) 8 Create a folder named Dahan_yoon in your local Create a new project named LabExer5A. Set the project location to your own The program shall: generate a random number from 1 to 50 for a player to guess; display a message that indicates whether the player’s guess is correct, too low, or too high; and prompt the user to keep on guessing until the correct value is entered Create a try-catch structure that will handle two (2) exceptions. These are when the user inputs the following: a number that is out of range (1 – 50) a letter or any non-numeric character Prompt the user so that he can guess again if an exception is Display the number of total Note: An invalid input (when an exception is thrown) is not considered a valid guess or attempt.arrow_forwardCreate a simple program for a quiz Software Requirements: Latest version of NetBeans IDE Java Development Kit (JDK) 8 Procedure: Create a folder named LastName_FirstName (ex. Dahan yoon) in your local Create a new project named LabExer5B. Set the project location to your own The program shall: contain an array of 10 multiple choice questions with three (3) choices each and require the user to choose among A, B, or C; Note: Cases are ignored. Lowercase letters are acceptable (a, b, c). Create a try-catch structure to handle three (3) exceptions. These are when the user inputs the following: an invalid letter (not A, B, or C) a number or any special character blank (no answer) Prompt the user that he can answer again if any of the three (3) exceptions is Display the score.arrow_forwardJAVA PPROGRAM ASAP Please Modify this program ASAP BECAUSE IT IS HOMEWORK ASSIGNMENT so it passes all the test cases. The program must pass the test case when uploaded to Hypergrade. Also, for test cases 1-4 it wants only to input Please enter the file name or type QUIT to exit: then input the file and display the Total number of words. For test cases 5 and 7 it wants to only to input Please enter the file name or type QUIT to exit then input input5.txt and then display File: input5.txt does not exist.\n then display Please enter the file name again or type QUIT to exit:\n then type input1.txt to display the total number of words or type quit to exit the program. For test case 6 it wants only to Please enter the file name again or type QUIT to exit:\n then type quit to exit the porgram. Chapter 9. PC #10. Word Counter (page 610) Write a program that asks the user for the name of a file. The program should display the number of words that the file contains. Input…arrow_forward
- Name SearchIn the Chap07 folder of the Student Sample Programs, you will find the followingfiles:• GirlNames.txt—This file contains a list of the 200 most popular names given to girls born in the United States from 2000 through 2009.• BoyNames.txt—This file contains a list of the 200 most popular names given to boys born in the United States from 2000 through 2009.Create an application that reads the contents of the two files into two separatearrays or Lists. The user should be able to enter a boy’s name, a girl’s name, orboth, and the application should display messages indicating whether the nameswere among the most populararrow_forwardC++HurdleWords The HurdleWords class is mostly provided to you. HurdleWords is constructed from two files in the data/ folder: ● valid_guesses.txt (all 5 letter guesses considered to be valid words to guess), and ● valid_hurdles.txt (all words that may be selected to be the secret Hurdle.) ● Note: you may edit both text files if you’d like to add custom words to your game. HurdleWords stores all potential valid Hurdles from valid_hurdles.txt into a vector of strings (valid_hurdles_), and all valid guesses from valid_guesses.txt into an unordered set of strings (valid_guesses_). A set is simply a data structure that contains no duplicates and allows for a speedy lookup to check if a given element exists within the set. Because there are over 10,000 valid guesses, we store them in an unordered set to leverage their speediness, as you will need to check if a user-submitted guess is considered valid (i.e. their guess is considered a valid guess in the dictionary). You are responsible for…arrow_forwardPendant Publishing edits multi-volume manuscripts for many authors. For each volume, they want a label that contains the author’s name, the title of the work, and a volume number in the form Volume 9 of 9. For example, a set of three volumes requires three labels: Volume 1 of 3, Volume 2 of 3, and Volume 3 of 3. Design an application that reads records that contain an author’s name, the title of the work, and the number of volumes. The application must read the records until eof is encountered and produce enough labels for each work. The flowchart must include a call symbol, at the beginning, to redirect the input to the external data file. create a solution algorithm using pseudocode create a flowchart using RAPTORarrow_forward
- Pendant Publishing edits multi-volume manuscripts for many authors. For each volume, they want a label that contains the author’s name, the title of the work, and a volume number in the form Volume 9 of 9. For example, a set of three volumes requires three labels: Volume 1 of 3, Volume 2 of 3, and Volume 3 of 3. Design an application that reads records that contain an author’s name, the title of the work, and the number of volumes. The application must read the records until eof is encountered and produce enough labels for each work. Design a flowchart and psuedocode Pendant Publishing.arrow_forwardFix the errors in the Customer class and the Program. DATA FILE ThinkAbout Tech 344 Park Ave, NY, NY 10022 Kemp Technologies 3601 Broadway, NY, NY 10021 Verizon 6 Hudson Street, NY, NY 10001 Merrill Lynch 7 World Financial Center, NY, NY 10001 Philips Laboratories 345 Scarborough Rd, Briarcliff Manor, NY 10510 CODE #include <iostream> #include <fstream>#include <string>using namespace std; class Customer { // Constructorvoid Customer(string name, string address) : cust_name(name), cust_address(address){acct_number = this.getNextAcctNumber();} // Accessor to get the account numberconst int getAcctNumber() { return acct_number; } // Accessor to get the customer namestring getCustName(} const { return cust_name; } // Accessor to get the customer addressstring getCustAddress() const { return cust_address; } // Set a customer name and addressstatic void set(string name, string address); // Set a customer addressvoid setAddress(string cust_address) { cust_address =…arrow_forwardFinish this program from the code posted below! Note: There should be two files Main.py and Contact.py You will implement the edit_contact function. In the function, do the following: Ask the user to enter the name of the contact they want to edit. If the contact exists, in a loop, give them the following choices Remove one of the phone numbers from that Contact. Add a phone number to that Contact. Change that Contact's email address. Change that Contact's name (if they do this, you will have to remove the key/value pair from the dictionary and re-add it, since the key is the contact’s name. Use the dictionary's pop method for this!) Stop editing the Contact Once the user is finished making changes to the Contact, the function should return. Code:from Contact import Contactimport pickledef load_contacts():""" Unpickle the data on mydata.dat and save it to a dictionaryReturn an empty dictionary if the file doesn't exist """try:with open("mydata.dat", 'rb') as file:return…arrow_forward
- JAVA PPROGRAM ASAP Hypergrade does not like this program because it says 2 out of 7 passed and take out the extra \n from the program. Please Modify and change this program ASAP BECAUSE IT IS HOMEWORK ASSIGNMENT so it passes all the test cases. The program must pass the test case when uploaded to Hypergrade. Also, for test cases 1-4 it wants only to input Please enter the file name or type QUIT to exit: then input the file and display the Total number of words. For test cases 5 and 7 it wants to only to input Please enter the file name or type QUIT to exit then input input5.txt and then display File: input5.txt does not exist.\n then display Please enter the file name again or type QUIT to exit:\n then type input1.txt to display the total number of words or type quit to exit the program. For test case 6 it wants only to Please enter the file name again or type QUIT to exit:\n then type quit to exit the porgram. import java.io.File;import java.io.FileNotFoundException;import…arrow_forwardUsing C# language please in Visual Studio 2022 in Windows Form App. As for the folder-- for convenience sake-- create some folders and insert a couple of names in there, not 200.arrow_forwardIN C LANGUAGE A well-known showroom allows managers to keep track of how many appliances are available or have been sold. Ask the user to input the following information for n number of appliances in the showroom: Code, Price, Status(Available/Sold) Create the following files: 1. “available_appliances.txt” that displays all the information of appliances available in the showroom. 2. “sold_appliances.txt” that displays all the information of sold appliances.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT