Redo or do for the first time
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Absolute Java (6th Edition)
Additional Engineering Textbook Solutions
Java How To Program (Early Objects)
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Computer Science: An Overview (12th Edition)
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Java: An Introduction to Problem Solving and Programming (7th Edition)
Digital Fundamentals (11th Edition)
- Write code that uses any type of loop. The code should continually ask for a user input and sums all user inputs that are divisible by 2. The loop should continue until the user enters a negative number. The code should output the sum a single time once user entry has completed. You may assume all libraries and namespaces have been previously written into the code, you are just writing everything that would go inside the main function (beyond the return 0:).arrow_forwardSolve it in C language // use new method plsarrow_forwardUse loop to solve this python program and use Error handling:IOError (File not found)arrow_forward
- Implement using python progeam 1) The Variables used here are as followes B : True if there is a Baseball Game on TV, False if not G: True if George watches TV, False if not C: True if George is out of Cat Food, False if not F: True if George feeds his cat, False if not. Let us say you are given some Training Data which represents what happens over a period of time (For example: This file contains what happens every evening over one specific year). Your Task is to learn the conditonal probabilty tables for the bayesian network from the training data. The training data will be formatted as follows: The first number is 0 if there is no baseball game on TV (B is false), and 1 if there is a baseball game on TV (B is true). The second number is 0 if George does not watch TV (G is false), and 1 if George watches TV (G is true). The third number is 0 if George is not out of cat food (C is false), and 1 if George is out of cat food (C is true). The fourth number is 0 if George does not feed…arrow_forwardUsing a Counter-Controlled whileLoop Summary In this lab, you use a counter-controlled while loop in a Java program provided for you. When completed, the program should print the numbers 0 through 10, along with their values multiplied by 2 and by 10. The data file contains the necessary variable declarations and some output statements. Instructions Ensure the file named Multiply.java is open. Write a counter-controlled while loop that uses the loop control variable to take on the values 0 through 10. Remember to initialize the loop control variable before the program enters the loop. In the body of the loop, multiply the value of the loop control variable by 2 and by 10. Remember to change the value of the loop control variable in the body of the loop. Execute the program by clicking Run. Record the output of this program.arrow_forwardC++ A teacher is requiring her students to line up in alphabetical order, according to their first names..For example, in one class Chapel, Christine would be at the front and Uhura, Nyota would be last. The program will get the names from a file. The names should be read in until there is no more data to read. The program should prompt the user for the file name and read the data from the file. A suitable file of names (List of Random Names) is provided on Moodle. Note that these names might include spaces; handle your input accordingly. The expected output is two names; do not show the entire file (or you will regret that code when you do the associated programming quiz that processes thousands of names). Do not use arrays or sorting for this problem.arrow_forward
- Your program should use a loop to read data from a text file which contains students' names and 3 exam scores. The program should calculate the exam average for each student, determine the appropriate letter grade for that exam average, and print the name, average, and letter grade. After printing all this, you need to print the count of the total number of A's, B's, C's, D's, and F's for the whole class. The text file you need to use can be accessed using this link: scores.txt. Copy this file to the folder where your program will reside. The text file contains a list of 30 records, and each record contains a name and that person's 3 test scores. Each field is separated by a tab character. The first 2 records looks like this: Davis 88 92 84Wilson 98 80 73 and so on. Your program will need to open this file and read each line until the end of file. I recommend calculating a student's exam average and letter grade as you read the file, although this is not a…arrow_forwardThis is for r Regarding a for loop, which of the following is not true? The for keyword must be followed by parentheses. Following the for statement, the code to be executed is recognized by it being indented. The number of times the loop will be performed is determined by the length of the vector passed to the for keyword. The for loop can contain other for loops.arrow_forwardIn java, create a program that will use a do while loop with a "yes/no" prompt. The program should include user input and output with getters and setters. Once the end of the loop is reached, ask the user if they'd like to do the program again. Answering "Yes" will start the program over again. Answering "No" will end the program. Answering with anything else will be an invalid input. Once the loop begins again, the program should also discard all previous inputs so that there won't be any overlapping. Use Scanner.nextLine();, it will help.arrow_forward
- Program in JAVA using While Loop Write a program that takes a positive integer input and prints the numbers starting from input until 0 in one line where each numbers are separated by a space. Note: There's an initial code prepared for you. Go directly to the code editor file and complete the solution. Input 1. A positive integer input Output Enter a number: 5 5 4 3 2 1 0arrow_forwardA criticism of the break and continue statements is that each is unstructured. These statements can always be replaced by structured statements. Describe in general how you’d remove any break statement from a loop in a program and replace it with some structured equivalent. [Hint: The break statement leaves a loop from within the body ofthe loop. Another way to leave is by failing the loop-continuation test. Consider using in theloop-continuation test a second test that indicates “early exit because of a ‘break’ condition.”] Use the technique you developed here to remove the break statement from the program of Fig. 5.13.arrow_forward5. Write a program using for loop to find the average mark of the class. The expected output is as shown in the output console: OUTPUT CONSOLE Please insert number of students: 5 Please insert Student 1's mark: 20 Please insert Student 2's mark: 100 Please insert Student 3's mark: 0 Please insert Student 4's mark: 70 Please insert Student 5’s mark: 70 The average mark of the class is 52.00 6. Repeat a program in Question 5 by using while loop.arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning