Create a text file that contains 10 integers with one integer per line. You can enter any 10 integers that you like in the file. Then write a
Want to see the full answer?
Check out a sample textbook solutionChapter 2 Solutions
Absolute C++
Additional Engineering Textbook Solutions
Web Development and Design Foundations with HTML5 (8th Edition)
SURVEY OF OPERATING SYSTEMS
Starting Out With Visual Basic (8th Edition)
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Starting Out with C++ from Control Structures to Objects (9th Edition)
Introduction To Programming Using Visual Basic (11th Edition)
- A Personal Fitness Tracker is a wearable device that tracks your physical activity, calories burned, heart rate, sleeping patterns, and so on. One common physical activity that most of these devices track is the number of steps you take each day. The steps.txt file contains the number of steps a person has taken each day for a year. There are 365 lines in the file, and each line contains the number of steps taken during a day. (The first line is the number of steps taken on January 1st, the second line is the number of steps taken on January 2nd, and so forth.) Write a program that reads the file, then displays the average number of steps taken for each month. (The data is from a year that was not a leap year, so February has 28 days.) You don't need to see the file , Just write a code using the "file" like this def main(): with open("steps.txt", "r") as file:arrow_forward12 Digit Barcode In this homework, you will develop a python program which reads a series of barcodes from "barcodes.txt" and creates an output file "output.txt" which contains the barcodes and their status as seen in the example output below. 153182953420 5+1+2.5.4-1 7+3+8+4+3+2-3 1 23601057072 6+t-13 Even : 2+6+1 +5+0 = 14 Odd: 1+3+0+ 0 +7+7 = 18 3 x8 = 24 D+3- 10 4 + 4 = 8 10 -8 = 2 (CORRECT) What to submit: 1) ipynb file which contains checkBarcode function which takes a string varlable as input and returns true or false, and a driver program which reads in "barcodes.txt" and creates "output.txt". Assume the input file contains one barcode info per line. Important: Your input file name MUST BE "barcodes.txt" and the output file name MUST BE "output.txt". Otherwise, you'l get up to 30 pts penalty Below a sample output.txt: 123601057072 is a valid 10-digits barcode lab601057072 is an invalid 10-digits barcode 172601055072 is an invalid 10-digits barcode 12345 is an invalid 10-digits…arrow_forwardPYTHON CODINGarrow_forward
- OBJECT ORIENTED PROGRAMMING LESSON LABORATORY EXERCISE-1 Problem: Write a program that takes position and current salary value from the user and calculate the new salary and shows it on the console according to the following table. Position Manager Salesman Human Resources Technician Headman Example: Enter your position: Manager Enter your current salary: 10000 New salary: 11000 Raise Percentage %10 %20 %15 %25 %23 Write your program using Java and copy your codes to a text file which has your name and surname. Then load it into UZEM under the provided link.arrow_forwardSolve it in C language // use new method plsarrow_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
- python Write a program that uses a text file to store the days and hours that a user worked in a week. The program should begin by prompting for the number of days worked in the week. It should continue with a loop for input of the days and hours and for writing these to the file, each on its own line. Sample Output (inputs shown in boldface)How many days did you work this week? 5Enter day of week MondayHow many hours did you work on Monday? 10Enter day of week TuesdayHow many hours did you work on Tuesday? 8Enter day of week WednesdayHow many hours did you work on Wednesday? 12Enter day of week FridayHow many hours did you work on Friday? 12Enter day of week SaturdayHow many hours did you work on Saturday? 8File was createdarrow_forwardUsing a Sentinel Value to Control a while Loop Summary In this lab, you write a while loop that uses a sentinel value to control a loop in a Java program that has been provided. You also write the statements that make up the body of the loop. The source code file already contains the necessary variable declarations and output statements. Each theater patron enters a value from 0 to 4 indicating the number of stars the patron awards to the Guide’s featured movie of the week. The program executes continuously until the theater manager enters a negative number to quit. At the end of the program, you should display the average star rating for the movie. Instructions Ensure the file named MovieGuide.java is open. Write the while loop using a sentinel value to control the loop, and write the statements that make up the body of the loop to calculate the average star rating. Execute the program by clicking Run. Input the following: 0, 3, 4, 4, 1, 1, 2, -1 Check that the average…arrow_forwardQuestion#2. The distance a vehicle travels can be calculated as fallout: Distance = Speed * Time For example, if a train travels 60 miles-per-hour for three hours, the distance [raveled is 120 miles. Write a program that asks for the speed of a vehicle (in miles-per-hour) and the number of hours it has traveled. It should use a loop to display the distance a vehicle has traveled for each hour of a time period specified by the user. For example, if a vehicle is traveling at 40 mph far a three-hour time period, it should display a report similar to the one chat follows: Hour Distance Traveled 1 90 2 100 3 150 Input Validation: Do not accept a negative number for speed and do not accept any value les than 1 for time traveled.arrow_forward
- PrimeAA.java Write a program that will tell a user if their number is prime or not. Your code will need to run in a loop (possibly many loops) so that the user can continue to check numbers. A prime is a number that is only divisible by itself and the number 1. This means your code should loop through each value between 1 and the number entered to see if it’s a divisor. If you only check for a small handful of numbers (such as 2, 3, and 5), you will lose most of the credit for this project. Include a try/catch to catch input mismatches and include a custom exception to catch negative values. If the user enters 0, the program should end. Not only will you tell the user if their number is prime or not, you must also print the divisors to the screen (if they exist) on the same line as shown below AND give a count of how many divisors there are. See examples below. Your program should run the test case exactly as it appears below, and should work on any other case in general. Output…arrow_forwardThe local t-shirt shop sells shirts that retail for $14.99. Quantity discounts are given as follow: Number of Shirts Discount < 10 0% 11-20 10% 21-50 15% 51 or more 20% Write a program that can run within a .cpp file that prompts the user for the number of shirts required and then computes the total price. Output the cost per shirt, discount percentage, and total cost. Make sure the program accepts only nonnegative input. You must use a constant to represent price of the shirt You must use the correct data types for your constants and variables You must validate your input. Do not allow negative number of shirts. This should display a warning You must use one or more if/else branches for your decisions You must also use a logical operator at least once to check the ranges. Your output should be formatted correctly Prices should have two decimal places Percents should have one decimal place Sample Run: How many shirts would you like?25 The cost per…arrow_forward2. The manager of a basketball stadium wants you to write a program that calculates the total ticket sales after each game. There are four types of tickets – box, sideline, premium, and general admission. After each game, data is stored in a file in the following forms: ticketPrice numberOfTicketsSold Sample data are shown below: 250 5750 100 28000 50 35750 25 18750 The first line indicates that the box ticket price is 250 pesos and that 5750 Tickets were sold at that price. Output the number of the tickets sold and the total sale amount. Format your output with two decimal places.arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning