Complete the class Problem 1, the program does the following: Prompt the user to enter an integer n.
Q: "Algorithm" is defined.
A: The definition of Algorithm is given below:
Q: Show the value of x after each of the statements is performed: x = fabs(-6.4);
A: Answer: x=6.4
Q: 10) Write a program that translates a letter grade into a number grade. Letter grades are A, B, C,…
A: note:- always mention programming language name in question, this is done in python. logic:-…
Q: rogram which return "fizz" if the number is a multiplier of 3, return "buzz" if its multiplier of 5…
A: The function fizz_buzz(num) takes an integer num as input and returns the corresponding FizzBuzz…
Q: our task is to develop a program that can achieve the same kact thing. Bear in mind the following…
A: # include<stdio.h> #include<conio.h> int main() { char operator, name;level;…
Q: State whether true or false. The following code will throw an error: double a = 2; double b = 3;…
A: Since the programming language is not mentioned, I have verified the code using C++.
Q: Write an algorithm that gets student exam scores from the user. Each exam score will be an integer…
A: Given: We have to write an algorithm that gets student exam scores from the user. Each exam score…
Q: Write code of program bluej: Challenge exercise Make a person walk up to the house after the sunset.
A: People_walk_towards_house_after_Sunset_in_Picture Open_Picture_project_in_BlueJ_software. This…
Q: 1) Simple Calculator: In Python, implement a simple calculator that does the following operations:…
A: Start:Initialize a loop to keep the calculator running until the user chooses to exit.Input:Ask the…
Q: tery The program prompts the user to enter a three-digit number and determines whether the user wins…
A: #code.py from random import randint lottery = str(randint(100, 999)) count = 0 user = input("enter a…
Q: No written by hand solution IN JAVA - NEEDS DRIVER AND CLASS PROGRAM Average Rainfall Write a…
A: Step-1) First, initializing the variables as int numberOfYears = 0, totalRainfall = 0;…
Q: 1. Write a an algorithm that asks the user to input a positive integer n and counts how many of the…
A: The algorithm is a step-by-step program instruction in a human-readable format. The number of steps…
Q: Q5. (Find the second lowest interger number) Write a program that prompts the user to enter a set of…
A: NOTE : As the question is not specific about the programming language to be used , so C++ will be…
Q: Problem #1: Car experts recommend changing your air filter as often as every 6000 miles if the oil's…
A: #include<stdio.h> int main(){ char category; //variable to store oil category int miles;…
Q: Given: boolean test; char x; Use a Character class method, to write a Java statement to assign true…
A: import java.util.Scanner; public class test3 { public static void main(String[] args)…
Q: OBJECT ORIENTED PROGRAMMING LESSON LABORATORY EXERCISE-2 Problem: We have to write a program in Java…
A: While learning any coding language, star patterns are the most prominent and widely utilized…
Q: Parking Charges) A parking garage charges a $2.00 minimum fee to park for up to threehours and an…
A: Lets see the solution.
Q: rite a program which calculates and prints the monthly pa lary is calculated after the following…
A: I have written code for this question below:
Q: Write pseudocode to describe an average mark calculator program that computes the average mark for a…
A: What is Pseudocode: It is a simple version of programming code written in english before it is…
Q: dayString=input("How numerous days do you intend to remain? ") days int(dayString) question…
A: The given code defines a function computeRate() that takes three parameters - days, x, and d. The…
Q: Happy Numbers Programming challenge description: A happy number is defined by the following process.…
A: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader;…
Q: the country, and its annual death rate. The program should then calculate the expected population…
A: import mathPopulation = int(input("Please Enter the Current Population of Country: "))Birth_rate =…
Q: Exercise 1: In this exercise we are asked to write a program that prompts the user for a positive…
A: Input n if(n>0) { while(n>0) { r=n%10; //find remainder…
Q: 1: You are given a list of students’ names and their test scores. Design algorithm that does the…
A: 1) START 2)Read the number of students 3)Read the test scores of the students into the one array…
Q: Write a program to repeatedly read in integers (negative and positive) from the user and zero (0) to…
A: 1.Start 2.Create an object of Scanner class to take input 3. Declare required variables po to count…
Q: Write a program (Là and displays, using asterisks, a filled diamond. For example, if the generated…
A: As no programming language is mentioned, we am writing the program in c++ #include…
Q: ask1: Arithmetic Operations (Java) An electronics store is giving…
A: 1) Below is JAVA program for an electronics store is giving discount based on the number of items…
Q: Problem #1: Car experts recommend changing your air filter as often as every 6000 miles if the oil's…
A: Actually, Java is a programming language originally developed by James Gosling at Sun Microsystems…
Q: sum öf its proper divišorS A perfect num (or factors). The smallest perfect number is 6, which is…
A: A value is said to be a perfect number if the sum of the factors of its numbers except itself is…
Q: A. Sum of Others: Write a program called sum_of_others.py Given three numbers x, y, z, determine if…
A: Steps in program: Take x, y, z as input Check using if-elif-else statement whether any two are sum…
Q: Write a simple calculator program that use 2 numbers entered by the user to perform any of the…
A: The program uses the Scanner package which is used for taking user inputs during run time. Classes…
Q: Write a program that will compute the students average •The user will input the following:…
A: Only the 1st question is answered. Please repost the other questions in another doubt session. As…
Q: Problem You have code that needs to perform simple time conversions, like days to seconds, hours to…
A: To perform conversions and arithmetic involving different units of time, use the datetime module.…
Q: In programming a good identifier is self-descriptive and mnemonic ("assisting memory" / "assists in…
A: In programming, a good identifier is a self-descriptive, and the mnemonic variable name that…
Q: Write a program that reads 10 numbers and then finds the largest number and prints it and finds the…
A: Programming language is not defined so I am providing program in python. Pseudo code Declare a…
Q: Q1. FizzBuzz problem:- Write a program which return "fizz" if the number is a multiplier of 3,…
A: The FizzBuzz problem is a classic programming task, often used in coding interviews. It tests your…
Q: DESCRIPTION Please make sure you use python 3+ version to do all of your homeworks. Please use…
A: Program: def main(): less_than_30000_count=0 between_30K_50K_count=0…
Q: In this program, you have to make use of the switch statement. The average life expectancy (in…
A: This question is from the understanding of the switch case statement. the switch statement is used…
Q: 5. Write a program to find the sum of even numbers until n, where n is an int entered by the user,…
A: According to bartleby guidelines we are supposed to answer only 1 coding question, hence i have…
Q: Which of the following statements is valid: Select one: a. int x-5; int a[x): b. const int x 5;…
A: Which of the following statements is valid: Select one: a int x=5; int a[x]; B. const int x 5;…
Q: program that answers the following questions: What numbers below 5000 are perfect? What odd numbers…
A: 1. Declare and initialize a variable- sum with value- 0. 2. Run a loop from 1 to ( n / 2). 1. If…
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 3 images
- Do your best# We have small bags of cement (10 kilograms each)# We have big bags of cement (50 kilograms each)# Return the number of each of the bags to use,# assuming we always use big bags before small bags.# Return -1 for each if it can't be done.## Oh, and there 4 errors in the main() function# Happy Debugging! import random def main():keep_going = "y" while keepgoing.upper() == "Y": small_bags = random.randint(5,20) big_bags = random.randint(1,5) goal = random.randint(60,350,10) small_used, big_used = make_cemont(small_bags, big_bags, gaol)if small_used == -1: print("Sorry, we can't reach", goal, "kilograms with", small_bags, "small bags and", big_bags, "big bags.")else: print("Goal", goal, "kilograms achieved!") print("Small bags:", small_used, "out of", small_bags) print(" Big bags:", big_used, "out of", big_bags) another_round = input("Try again (y/n)?: ")def make_cement(small_bags_supplied, big_bags_supplied,…Collapse Problem #2 Complete the class Problem2, the program does the following: • The program prompts the user to enter an integer. • The program continues to prompt the user for more integers as long as the sum of all values entered is between 1 and 50. • If the sum of all values entered is NOT between 1 and 50, Java the program stops taking integers, then display the value of sum. Here are two sample outputs, your output should look exactly the same as follows: Enter an integer: 23 Enter an integer: 1 I Enter an integer: -2 Enter an integer: 19 Enter an integer: -25 Enter an integer: 4 Enter an integer: 9 Enter an integer: -20 Enter an integer: -5 Enter an integer: -12 AK -8 lacBook Air
- QI: tinclude (a) Write two different techniques to declare and initialize a variable with an example. using namespace std; void repchar(char, int); int main() (b) Write a program that simulates a simple cakulator. It reads two integers and a character. If the character is a +', the sum is printed; if it is a , the difference is printed: if it is a *", the product is printed; if it is a ", the quotient is printed; and if it is a %', the repchar(", 43): cout "Data type Range" endl; repchart-, 23). cout e "char-128 to 127" < endl4) Roll the dice 2 Make a program that tests the probability of a certain score when rolling x dice. The user should be able to choose to roll eg 4 dice and test the probability of a selected score eg 11. The program should then do a number of simulations and answer how big the probability is for the selected score with as many dice selected. There must be error checks so that you cannot enter incorrect sums, for example, it is not possible to get the sum 3 if you roll 4 dice. TarningsKast2 How many dices do you want to throw? 11 Which number do you want the probability for? The probability the get the number 11 with 4 dices is 7.19% CalculatePython Programming Part 2 Direction: Use PYTHON to solve this problem. Description: This part tests for two things. The program must identify all resistors in series or in parallel with each other and calculate the equivalent resistance for each group of resistors. Recall that total resistance of resistors in series are added up while the total conductance of those in parallel are added up. Input Format: The first line of the input consists of 1 integer N which is the total number of resistors. The next N lines will consist of 3 strings and an integer R each separated by a space. The first string is the resistor name, the second and third strings are the node names where the resistor terminals are connected, and R is its resistance value. Output Format: One line for each group of resistors in series or parallel. Each line starts with a list of resistors arranged in lexicographical order (see Lexicographic order - Wikipedia) followed by their total resistance rounded off to the nearest…Problem #3: Write code that divides a positive number n in half until the resulting number is less than 1. For this exercise, use a method that doesn't require you to convert the integer n to a different data type. For example, if n = 5, the first time through the loop should result in 2.5, the second time through should result in 1.25, and the third time through should result in 0.625. The loop should not be executed a forth time since 0.625 =10: 5 4 3 print (n) HN W 2 (missing line) n=n//10 1 print (r)The following table shows the rate of commission that will be paid to the salesman according to the total sales performance of the month:Total Sales Performance (RM) CommissionLess than 10000 No commission10000 – 20000 1% of the total sales20001 – 30000 2% of the total sales30001 – 40000 3% of the total salesMore than 40000 4% of the total sales Write a complete program that will perform the following tasks:i. Declare appropriate variables for the above problem.Print the given line in F95. "Welcome to programming journey with F95".Q1: Can you read this question carefully rebug and type the answers Debug Problem 1: As an intern for The Weather Channel, you have been instructed to debug a java program that converts Celsius to Fahrenheit. If the formula runs correctly, then 12 degrees in Celsius should give 54 degrees in Fahrenheit . Here is the formula given and it might not be correctly stated in terms of () needed and the order of operations. Google a reputable site if needed.: °F = °C x 9/5 + 32 Remember that there may be more than one problem to fix. It could be that variables have an incorrect data type. It could be that the formula is not coded correctly. Also, some import statements could be missing. Copy and paste the code below in JGrasp and debug the code. Here is the code to debug: // Convert Celsius to Fahrenheit class CelsiusToFahr { public static void main (String args[]) { Scanner keyboard = new Scanner(System.in); int celsius = 0; int fahr = 0; System.out.println("Input the degrees in…Assignment 1/ Reset to Starter Code 2. Problem 2: Product ID Numbers Saved Problem Description In this second problem, you will build on and extend the program created while solving the first problem. You will be expected to isolate both the product id number and company number from the barcode number of the item to be purchased by the customer. Input You will receive (from the user) the following as input (in order): • The first and last name of the customer (e.g., Eric Poitras) • The item to be purchased, identified through a barcode number (e.g., 1909238092) • The cost of the item to be purchased by the customer (e.g., 8.50) • The cash amount given by the customer (e.g., 10.00) Processing 1. Extract the product id and company id numbers 2. Print the data stored in each variable in the corresponding format Output 1. Customer (Last, First): {LAST} {FIRST} 2. Item Number (Product, Company): {PRODUCT} {COMPANY} 3. Item Cost: (COST} 4. Cast Amount: {CASH} Examples Input Output Eric…Sir!