Concept explainers
First, launch NetBeans and close any previous projects that may be open (at the top menu go to File ==> Close All Projects).
Then create a new Java application called "WeightedAvgDropSmallest" (without the quotation marks) according to the following guidelines.
The program prompts the user for five to ten numbers all on one line, separated by spaces, calculates the weighted average of all those numbers except the lowest n numbers, where n and the weight are also given by the user, and displays all the numbers, the weight, the number of lowest numbers dropped, and the calculated average to the user.
The program uses methods to: SEE BELOW
Get the numbers used to calculate the average
Get the number of lowest numbers to drop before calculating the average
Get the weight, a double greater than 0 and less than or equal to 1
Calculate the weighted average of the numbers (except the lowest n numbers) entered by the user
Print the results
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images
- Write an application that counts by five from 5 through 500 inclusive and that starts a new line after every multiple of 50 (50,100,150 and so on).Save the file as CountByAnything.javaarrow_forward3. Which among the following shows a valid use of the Direction enumeration as a parameter to the moveCharacter function? Select al that apply. enum Direction { case north, south, west, east}func moveCharacter(x: Int, y: Int, facing: Direction) {// code here} moveCharacter(x: 0, y: 0, facing: .southwest) moveCharacter(x: 0, y: 0, facing: Direction.north) moveCharacter(x: 0, y: 0, facing: .south) moveCharacter(x: 0, y: 0, facing: Direction.northeast)arrow_forwardYou are a manager of a Wally's Training Gym and you encourage your trainers to enroll new members. Input is the trainer's last name and the number of new enrollees, and names of each new member. Output is the number of trainers who have enrolled members in each of three categories: 0-5 new members, 6-10 new members, and 11 to 15 new members, as well as the names of each new enrollee. Write an application that allows the user to enter any number Trainer's names, number of new members, and names of each new member. Output is to display the names of trainers who are in each category, and the new members enrolled. Use good programming techniques and use appropriate variable names, use an array to store the names and number of new enrollees, and use prompts for the input and labels with the display. Write your program using Python. You may use a free version of Python at Replit. com Both header comments and step comments are encouraged as it will help for logic to be better. Header…arrow_forward
- Assign numMatches with the number of elements in userValues that equal matchValue. userValues has NUM_VALS elements. Ex: If userValues is {2, 1, 2, 2} and matchValue is 2, then numMatches should be 3. Your code will be tested with the following values: matchValue: 2, userValues: {2, 1, 2, 2} (as in the example program above) matchValue: 0, userValues: {0, 0, 0, 0} matchValue: 10, userValues: {20, 50, 70, 100} (Notes) 324758.2040686.qx3zgy7 3 int main(void) { const int NUM VALS = 4; int userValues[NUM_VALS]; int i; int matchvalue; int numMatches = -99; // Assign numMatches with e before your for loop 4 1 test 5 passed 6 7 All tests 8 passed 9 scanf ("%d", &matchValue); 10 11 for (i = 0; i < NUM_VALS; ++i) { scanf("%d", &(userValues[i])); } 12 13 14 15 16 * Your solution goes here */ 17 18 printf("matchvalue: %d, numMatches: %d\n", matchValue, numMatches); 19 20 return 0;arrow_forward1. ponder_orb_density One of the most important questions to ponder about an orb is: what is the density of this orb? Here we will assume a spherical orb and calculate (ponder) its density as a function of its radius and mass. Recall that density is mass/volume, and recall (or look up) that the volume of a sphere is 4/3 * pi * r3. Sample calls should look like: >>> ponder_orb_density(1, 1)0.23873241463784303>>> ponder_orb_density(1, 10)2.3873241463784303>>> ponder_orb_density(2.5, 200)3.0557749073643907arrow_forwardMicrosoft Visual C# 7th edition. In Chapter 7, you modified the GreenvilleRevenue program to include a number of methods. Now, using your code from Chapter 7 Case Study 1, modify your program so every data entry statement uses a TryParse() method to ensure that each piece of data is the correct type. Any invalid user entries should generate an appropriate message that contains the word Invalid, and the user should be required to reenter the data. Cengage requirement for the shaded part is attached and I don't understand it. I need help with the highlighted part (getContestantData() method) please. Thanks using System; using static System.Console; using System.Globalization; class GreenvilleRevenue { static void Main() { int numLastYear; int numThisYear; double revenue; int fee = 25; const int MAX_CONTESTANTS = 30; string[] names = new string[MAX_CONTESTANTS]; char[] talents = new char[MAX_CONTESTANTS]; char[] talentCodes = { 'S', 'D', 'M', 'O'…arrow_forward
- using visual studio and the C# please dont copy the previous answered questions because the solution is incorrect In the Chap07 folder of the Student Sample Programs, you will find a file named ChargeAccounts.txt. The file contains a list of a company’s valid charge account numbers. There are a total of 18 charge account numbers in the file, and each one is a 7-digit number, such as 5658845. Create an application that reads the contents of the file into an array or a List. The application should then let the user enter a charge account number. The program should determine whether the number is valid by searching for it in the array or List that contains the valid charge account numbers. If the number is in the array or List, the program should display a message indicating the number is valid. If the number is not in the array or List, the program should display a message indicating the number is invalidarrow_forwardSlappy’s Software Sales AssignmentYou have been hired by Slappy’s Software Sales to write a program to figure thetotal cost to customers that order Slappy’s software packages.Discounts are given based on the number of units sold:Number of Units Sold Discount Amount1 – 9 None10 – 19 20%20 – 49 30%50 – 99 40%100 or more 50%Create a form similar to this:The three boxes are labels. Remember to use the Auto Size and Border Styleproperties.The program should read the number of units sold and figure a base cost. Theunits cost $99 each. A discount should then be figured and subtracted from thebase cost. The subtotal, discount amount and total cost should be displayed, ascurrency, in the appropriate labels.Here are some screen shots of the running program:Set the tab order and access keys.Put comments in your program as to what each section is doing.Use constants for the discount rates and base price.arrow_forward*with psuedo code First, launch NetBeans and close any previous projects that may be open (at the top menu go to File ==> Close All Projects). Then create a new Java application called "WeightedAvgDataAnalyzer" (without the quotation marks), that does the following: This program is similar to the previous assignment - "WeightedAvgDropSmallest" - with a major difference that the inputs for the program will be read from a file and the output for this assignment should be written to a new file. The concept of application is as follows: The program will read numbers from a file - data.txt - that you will create, where the weight is a double (greater than 0.0 and less than or equal to 1.0) and the other numbers are the number, n, of lowest values to drop and then the numbers to be averaged after dropping the lowest n values. Example data.txt file would display: 0.5 3 10 70 90 80 20 The program then calculates the weighted average of all those numbers except the lowest n numbers, where…arrow_forward
- Write a program which should handle books information for a book shop. It should be able to handle atleast 100 records. Your program should store following information against a book. Book Id (you may use index number as book ID) Book Code Book Name Author Name Publish Date Price No of copies in hand No of Copies sold Initialize 10 Books and initialize remaining with 0 and spaces. Create a menu, as given below, which should use above information to perform selected action from the given menu on the screen Add book (One book will be added. User will enter book id i.e. index number Record will be placed if code at that index is 0) Display book (Display Books in tabular format with nonzero codes only) Delete book (Place an empty record with 0 code and spaces at the selected index) Search book Sale book (First locate the book Id and check if code is not 0 then update No of Copies in hand and No of Copies sold accordingly) Exit Your assignment will be evaluated on the following basis:…arrow_forward1 dosage = 100 2 time since_last_dose = 7 3 is nighttime = False 4 took something_cross_reactive = False 5 6 #You may modify the lines of code above, but don't move them! 7 #When you Submit your code, we'll change these lines to 8 #assign different values to the variables. 9 # 10 # Let's try to use our mathematical operators and logical 11 #operators together. 12 # 13 #Imagine you've been battling a cold. You're deciding whether 14 #to take cough syrup or not, and if so, how much to take. 15 # 16 #time_since_last_dose represents the number of hours since 17 #you Tast took some cough syrup. For every hour it's been, 18 #you're allowed to have one dose. 19 # 20 #If it's nighttime (is_nighttime), then you may double 21 #your dose since you won't be taking any until morning. 22 # 23 #However, if you've taken something cross-reactive 24 #(took_something_cross_reactive), then you should not take 25 #any cough syrup. 26 # 27 #Write a program that will print how large a dose of cough 28 #syrup…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education