13. Magic 8 Ball Write a program that simulates a Magic 8 Ball, which is a fortune-telling toy that displays a random response to a yes or no question. In the student sample programs for this book, you will find a text file named 8_ball_responses.txt. The file contains 12 responses, as "I don't think so", "Yes, of course!", "I'm not sure", and so forth. The program should read the responses from the file into a list. It should prompt the user to ask a question, then display one of the responses, randomly selected from the list. The program should repeat until the user is ready to quit. such 99 Contents of 8_ball_responses.txt: Yes, of course! Without a doubt, yes. You can count on it. For sure! Ask me later. I'm not sure. I can't tell you right now. I'll tell you after my nap. No way! I don't think so. Without a doubt, no. The answer is clearly NO.
Q: Using Visual Studio , C# Demonstrate the method in an application that lets the user experiment…
A: Using Visual Studio , C# Demonstrate the method in an application that lets the user experiment…
Q: Code in task2() method as below. Using the String format method just once, display the integer…
A: Code: public class SFormat { public static void main(String[]args) {…
Q: Please include a gui for the encryption and decryption java code. Example of the gui in the photos…
A: java program can be used to write applications on the different types of the platforms that can run…
Q: what will be the output after code shown below is being executing Public Class Form1 Dim NUM1 As…
A: + is arithmetic operator but it acts as concatenation operator when operands are string.
Q: 4. Get user to enter a phrase and print out how long the phrase is(Hint: use String method).…
A: Sol 4: The below given Java program will obey the following rubrics: Importing required data…
Q: def scylla_or_charybdis(moves, n): This problem was inspired by the article "A Magical Answer to…
A: The python is a easiest programming language. It is a dynamically typed programming language.
Q: This must be done in Java.util.scanner. Class. Everything must have comments Write a Java…
A: ALGORITHM:- 1. Take input from the user. 2. Generate the random number between 1 and 10. 3. Display…
Q: sendregion aregion Question | * In your Main() method, using a suitable looping structure, write the…
A: According to the information given:- We have to follow the given instruction to create a c# program.
Q: UOWD Library is asking you to write a Java program that manages all the items in the Library. The…
A: Here Are all the files: Media: package medialibrary; public class Media { String mediaType;…
Q: 1. Employee Class Write a class named Employee that has the following fields: name. The name field…
A: Actually, Java is a high level programming language. And also object oriented .It. Is a platform…
Q: AI Hikma book shop provides a menu to customers with title and prices, and the user selects an item…
A: import java.util.Scanner;public class Main{ public static void main(String[] args) { Scanner sc…
Q: Write a program that reads five cards from the user, then analyzes the cards and prints out the…
A: As no programming language is mention. So i am using c++.
Q: help me solve this in the Java language. The Game class is part 1, but I need you guys to help me…
A: We need to define the main() as per the given description.
Q: First, launch NetBeans and close any previous projects that may be open (at the top menu go to File…
A: Sample Response: //Java program to find the sum of each row by using functionspackage scorer; import…
Q: I need help debugging this : // This application displays some math facts public class DebugThree2…
A: // This application displays some math factspublic class DebugThree2{ public static void add(int…
Q: Try to use eclipse please
A: The solution for the above given question is given below:
Q: uppose, you are working in a company ‘X’ where your job is to calculate the profit based on their…
A: Note:- I am taking the Python part. Program: class FinalQ: def print(self,array,idx):…
Q: res plays the three variables' values in sentences. tor method with three parameters for the three…
A: I give the code along with output and code screenshot
Q: Create a class called "Session12Lab". Create a method public static String[] mergeArrays(String[]…
A: Please find the answer below :
Q: C# Student Loan Calculator Loan Amount Number of Years In Defement? O Yes 3 O No Interest Rates…
A: Designer.cs namespace Loan_month_calculator{partial class Form1{/// <summary>/// Required…
Q: PROBLEM: Create your own massive multiplayer online game (MMORPG) hero. Use a class named…
A: In this question we have to write a C++ program in which we have been asked to create a constructor…
Q: First, launch NetBeans and close any previous projects that may be open (at the top menu go to File…
A: Program:import java.util.Scanner; public class Scorer{ public static void main(String args[]) {…
Q: solve in python Street Class Step 1: • Create a class to store information about a street: •…
A: Here is the required code implemented in Python 3.8, having two ways : - First part : -…
Q: create an application that will have only one button and a text of hello world when the user click…
A: import java.awt.BorderLayout;import java.awt.FlowLayout;import java.awt.LayoutManager;import…
Q: Java Your program will read in a credit card number and expiration date from the user and validate…
A: The program makes use of Scanner class defined inside java.util package. The syntax for it is:…
Q: art A Write a menu-driven program that will give the user the three choices: 1) Wage calculator, 2)…
A: import java.util.*;class partA{ public static void main(String a[]) { String name;float…
Q: this many times but couldn't get it. Thanks in advance Create a class to hold data about a high…
A: code : Team.java public class Team{ //declaring instance variables private String schoolName;…
Q: First, launch NetBeans and close any previous projects that may be open (at the top menu go to File…
A: The Java program and the program plan to calculate the average of the elements of three rows of a…
Q: a Questions - (Has 2 Parts). Based on each code, which answer out of the choices "A,B,C,D,E" is…
A: The given parts are related to Java packages (in-built) calendar and TimeZone which are used to get…
Q: Write an application that determines whether a phrase entered by the user is a palindrome. A…
A: import java.util.*; class palindrome{ void palin(){System.out.print("Enter the string you want…
Q: lass Design – Date V0.0 & V1.0 Create a new project for this lab and create a new class inside…
A: The given problem will need an implementation of Date class that adds all the actions tha can be…
Q: java Jframe 6. Cell Phone Packages Cell Solutions, a cell phone provider, sells the following…
A: Answer :
Q: Mastermind In this assignment, you will program the well-known game Mastermind. In Mastermind,…
A: we have to make above programme which is written below
Q: Please help me fix this program. It is constantly saying I have duplicates of class main and many…
A: Java is the programming language that are used to create and develop applications , websites etc.,…
Q: please use java to answer the following question Implement a program with a GUI and Action listener…
A: import java.awt.Image;import java.awt.Toolkit;import java.util.logging.Level;import…
Q: ***PLEASE LOOK AT IMAGES AS WELL FOR HELP*** ***PLEASE MAKE IT SIMPLE, I DON'T NEED ANYTHING…
A: The answer is given below:-
Q: The goal of this assignment is to solve problems that involve flow of control with conditional…
A: Here, I have to provide a C++ solution to the above question.
Q: Using python: (see attached- I need help with part Q2) Add a method to the person class name it…
A: In Step 2 I have defined the function Here the variable for email is"email" use that function inside…
Q: how to run this code solve me the errors in picture Public Class Form1 ''Double click the form…
A: Declaration of array of strings: Dim array1() As String = {"Algeria", "Albania", "Antartica"} or…
Q: Write an application that counts by five from 5 through 500 inclusive and that starts a new line…
A: Actually, program is a executable software that runs on a computer.
Q: The xxx_Student class:– Name - the name consists of the First and Last name separated by a space.–…
A: Create all required class, and instance variables required to perform the calculation.Then, in the…
Q: A class which is called Book consists of: • Instance Variable bTitle (String): book title authors []…
A: I have implemented everything and everything is working perfectly The strcuture of the whole system…
Q: import javax.swing.JOptionPane; public class MultipleChoiceQuestion { static int correct = 0;…
A: The bugs were completely removed, please follow the procedure to run java program that is file name…
Q: Read the instructions below and write your code using Microsoft Visual Studio (Community version).…
A: the code is given below :
Q: Using javascript getElementByClass- write a simple programe whereby each time a player gets shot by…
A:
Q: Create a new Java project and make sure "Create project from template" is UNCHECKED). Use a…
A:
Q: Question (1): Define the ReplaceAll method, its idea to search for partial text (word or phrase)…
A: Sample Response: //Java Programimport java.util.*;import java.util.regex.*;//class defintionpublic…
Python
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images
- For this assignment, you will write a program that reads employee work data from a text file, and then calculates payroll information based on this file. The text file will contain one line of text for eachemployee. Each line consists of the following data (delimited by spaces or tabs):1) employee’s id2) employee’s hourly wage rate3) hours worked Monday4) hours worked Tuesday5) hours worked Wednesday6) hours worked Thursday7) hours worked Friday ex) txt file attached Your program should first prompt the user to get the location of the input file. Then it will read the data from the file, put it in appropriate arrays (as described below), and output to the screen the following information: (1) the employee ID, total number of hours worked, regular pay, overtime hours, overtime pay, and total paid to each employee (2) the total hours worked by all employees throughout the week; (3) the total amount paid out to all employees for the week; (4) the employee who received the highest pay for…JAVA PROGRAM ASAP Please CREATE A program ASAP BECAUSE IT IS LAB ASSIGNMENT #2 so it passes all the test cases. The program must pass the test case when uploaded to Hypergrade. Chapter 9. PC #16. Morse Code Translator (modified *** Read carefully ***) Morse code is a code where each letter of the English alphabet, each digit, and various punctuation characters are represented by a series of dots and dashes. Write a program that asks the user to enter a file name containing morse code, and then converts that code to text and prints it on the screen. The Morse code table is given in a text file morse.txt. When printing resulting text, display one sentence on each line. There should be no extra spaces at the beginning and at the end of the output. Mose.txt 0 -----1 .----2 ..---3 ...--4 ....-5 .....6 -....7 --...8 ---..9 ----., --..--. .-.-.-? ..--..A .-B -...C -.-.D -..E .F ..-.G --.H ....I ..J .---K -.-L…4. WarningWrite a program that will read in a file of student academic credit data and create a list of students on academic warning. The list of students on warning will be written to a file. Each line of the input file will contain the student name (a single String with no spaces), the number of semester hours earned (an integer), the total quality points earned (a double). The following shows part of a typical data file:Smith 27 83.7Jones 21 28.35Walker 96 182.4Doe 60 150The program should compute the GPA (grade point or quality point average) for each student (the total quality points divided by the number of semester hours) then write the student information to the output file if that student should be put on academic warning. A student will be on warning if he/she has a GPA less than 1.5 for students with fewer than 30 semester hours credit, 1.75 for students with fewer than 60 semester hours credit, and 2.0 for all other students. The file Warning.java contains a skeleton…
- JAVA PROGRAM Chapter 4. Homework Assignment (read instructions carefully) Write a program that asks the user for the name of a file. The program should read all the numbers from the given file and display the total and average of all numbers in the following format (three decimal digits): Total: nnnnn.nnn Average: nnnnn.nnn Class name: FileTotalAndAverage double_input1.txt double_input2.txt PLEASE MODIFY THIS CODE, SO WHEN I UPLOAD IT TO HYPERGRADE IT PASSES ALL THE TEST CASES, BECAUSE WHEN I UPLOAD IT TO HYPERGRADE IT DOES NOT PASS THE TEST CASES. IT HAS TO PASS ALL THE TEST CASES. I PROVIDED THE CORRECT OUTPUT AS A SCREENSHOT AS A REFERRENCE. import java.io.BufferedReader;import java.io.FileReader;import java.io.IOException;import java.util.InputMismatchException;import java.util.Scanner;public class FileTotalAndAverage { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String fileName; do {…Requested files: InClass02.java, input.txt Maximum number of files: 6 Create a simple java program that reads all the content in a .txt file, the user will enter the filename to be opened. In this case, the file will contain multiple lines of student details with each line containing a single student detail. Your task is to then create a student class that models the firstname, lastname, year of birth and gender of every student. The student class should further be able to assign every student created with a student number using a class variable[format is 2022000X, X is a number such as 1,2..] and be able to calculate the age of each student. Within the driver class add all the students read from file into an ArrayList and then print the first and last student in the list. You are additionally expected to deal with most common exceptions(See samples below) [HINT: DO NOT PROVIDE A PATH BUT RATHER ONLY OPEN THE FILE WITH RELATIVE PATH/FILENAME] Sample run 1: Enter filename:…instruction- This file should have multiple lines, each line has first name, last name followed by multiple integers “data.txt” file Samantha Johns 43, 32,99, 79, 85 Michael Smith 98, 84, 70, 100, 76, 81 John Michael 82,92, 92 Mary Hernandez 88, 91, 92, 79, 78 George Johnson 92,93,75 Sara Anderson 83,74. Susan John 78, 84,65, 71,81 Mark Smith 69, 67,59,62
- PROGRAMMING LANGUAGE: C++ Write a program which has a class named FileHandlerto read StudentName, MarksObtained from the attached picture. The class should have a function which calculates grade for a student and then adds it in a new column i.e. Grade. The grade should be calculated considering the following criteria. A: 87-100, B+: 80-86, B: 72-79, C+: 66-71, C: 60-65, D: 50-59, F: 0-49 The file should be saved once grade for all students is calculated. Write the driver program for executing the task.JAVA PROGRAM Chapter 4. Homework Assignment (read instructions carefully) Write a program that asks the user for the name of a file. The program should read all the numbers from the given file and display the total and average of all numbers in the following format (three decimal digits): Total: nnnnn.nnn Average: nnnnn.nnn Class name: FileTotalAndAverage double_input1.txt double_input2.txt Test Case 1 Please enter the file name: \ndouble_input1.txtENTERTotal: -5,748.583\nAverage: -57.486\n Test Case 2 Please enter the file name: \ndouble_input2.txtENTERTotal: 112,546.485\nAverage: 56.273\n Test Case 3 Please enter the file name: \ndouble_input3.txtENTERFile 'double_input3.txt' does not exist.\nPlease enter the file name again: \ndouble_input1.txtENTERTotal: -5,748.583\nAverage: -57.486\n1. Copy the previous program to a new file. #include <iostream> using namespace std; class Vehicle{ private: string brand; public: Vehicle() { this->brand = "TBD"; } Vehicle(string brand) { this->brand = brand; } void output() { cout << "Brand: " << this->brand << endl; } string getBrand() const { return brand; } void setBrand(const string &brand_) { brand = brand_; }}; class Car:public Vehicle{ private: int *weight; //declaring dynamic variable public: Car():Vehicle() //calling Vehicle default constructor { weight=new int; //allocate memory *weight=0; //initialize weight to 0 } Car(string b, int w):Vehicle(b) //invokes Vehicle parameterized constructor {…
- JAVA PROGRAM Chapter 4. Homework Assignment (read instructions carefully) Write a program that asks the user for the name of a file. The program should read all the numbers from the given file and display the total and average of all numbers in the following format (three decimal digits): Total: nnnnn.nnn Average: nnnnn.nnn Class name: FileTotalAndAverage PLEASE FIX, CHANGE AND MODIFY THIS JAVA PROGRAM SO WHEN I UPLOAD IT TO HYPERGRADE IT PASSES ALL TEST CASSES PLEASES. RIGHT NOW IT SAYS 0 OUT 3 PASSED. THE PICTURES THAT I PROVIDED PROOF THAT WHEN I UPLOAD IT TO HYPERGRADES IT FAILS TEST CASSES. THANK YOU. import java.io.BufferedReader;import java.io.FileReader;import java.io.IOException;import java.util.InputMismatchException;import java.util.Locale;import java.util.Scanner;public class FileTotalAndAverage { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String fileName; do {…JAVA PROGRAM Chapter 4. Homework Assignment (read instructions carefully) Write a program that asks the user for the name of a file. The program should read all the numbers from the given file and display the total and average of all numbers in the following format (three decimal digits): Total: nnnnn.nnn Average: nnnnn.nnn Class name: FileTotalAndAverage PLEASE FIX AND MODIFY THIS JAVA SO WHEN I UPLOAD IT TO HYPERGRADE IT PASSES ALL TEST CASSES PLEASES. RIGHT NOW IT SAYS 0 OUT 3 PASSED. THE PICTURES THAT I PROVIDED PROOF THAT WHEN I UPLOAD IT TO HYPERGRADES IT FAILS TEST CASSES. THANK YOU. import java.io.*;import java.util.Scanner;public class FileTotalAndAverage { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Please enter the file name: "); while (true) { String fileName = scanner.nextLine(); File file = new File(fileName); if (file.exists() &&…COMPUTER SCIENCE 130 JAVA PROGRAM Chapter 4. Homework Assignment (read instructions carefully) Write a program that asks the user for the name of a file. The program should read all the numbers from the given file and display the total and average of all numbers in the following format (three decimal digits): Total: nnnnn.nnn Average: nnnnn.nnn Class name: FileTotalAndAverage double_input1.txt double_input2.txt PLEASE FIX AND MODIFY THIS JAVA SO WHEN I UPLOAD IT TO HYPERGRADE IT PASSES ALL TEST CASSES PLEASES. RIGHT NOW IT SAYS 0 OUT 3 PASSED. THE PICTURES THAT I PROVIDED PROOF THAT WHEN I UPLOAD IT TO HYPERGRADES IT FAILS TEST CASSES. THANK YOU. import java.io.BufferedReader;import java.io.FileReader;import java.io.IOException;import java.util.InputMismatchException;import java.util.Locale;import java.util.Scanner;public class FileTotalAndAverage { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String…