Craps. Here are the rules for a pass bet in the game of craps: Roll two 6-sided dice, and let x be their sum. • If x is 7 or 11, you win. • If x is 2, 3, or 12, you lose. Otherwise, repeatedly roll two the dice until their sum is either x or 7. • If their sum is x, you win. • If their sum is 7, you lose. Compose a modular program to estimate the probability of winning a pass bet. Modify your program to handle loaded dice, where the probability of a die landing on 1 is taken from the command line, the probability of landing on 6 is 1/6 minus that probability, and 2-5 are assumed equally likely. Hint: Use stdrandom.discrete ()
Q: Write a program that simulates flipping a coin to make decisions. The input is how many decisions…
A: you are increasing value of i two times. There is problem. Make sure save your file after writing…
Q: Hello, welcome to the Code Blasters code-writing competition! So, let's start with the exercise…
A: Input-Output Explanation: The first line of the input contains a single integer TT .TT denoting the…
Q: 4. Before you can cross a bridge with your car, it must weigh within +/- 100 pounds of 1 ton For…
A: Hey, since multiple questions posted, we will answer first question according to our policy. If you…
Q: Write a program that works out if a given year is a leap year This is how to workout whether if a…
A: The complete Javascript code is given below with code and output screenshot
Q: 1. Write a program where 52 deck of cards are suffled and 4 unique cards are dealt to a player. A…
A: #include<iostream> #include<cstdlib> #include<string.h> using namespace std; int…
Q: 3. Scientific notation is a way to express numbers that are too large in a more convenient decimal…
A:
Q: Mother is the most loved person. She wants to surprise his son on his birthday so she prepares a…
A: Process: Input for the value which decide the total iteration After that run the value loop…
Q: Sometimes we write similar letters to different people. For example, you might write to your parents…
A: Note: Since no programming language is mentioned in the question, the program has been provided in…
Q: A retail company assigns a $5000 store bonus if monthly sales are more than $100,000; otherwise a…
A: Introduction: We need to Complete the missing lines in the given Module 2 according to the…
Q: An electronic shop wants you to write a program to take orders from the clients and print the…
A: while changing from input type to number to string, make sure you clean the unwanted spaces in the…
Q: ABC Bank announced a new scheme of reward points for a transaction using an ATM card.Each…
A: Code: import java.util.*;public class Demo{ public static void main(String args[]) { Scanner…
Q: An electronic shop wants you to write a program to take orders from the clients and print the…
A: function main: Start read item read price read quantity read delivery type if delivery is fast then…
Q: Write a program that simulates flipping a coin to make decisions. The input is how many decisions…
A: Program algorithm- STARTStep 1: Import the essential headers.Step 2: Define the main function.Step…
Q: An employee’s weekly working hours is 40. If an employee exceeds 40 hours, it is considered…
A: Introduction of the Program: The C++ program takes to input the number of hours worked by employee…
Q: Write a program that simulates flipping a coin to make decisions. The input is how many decisions…
A: read number_of_flips pass it to function. set i=0 while i<number_of_flips:…
Q: When you borrow money to buy a house, a car, or for some other purpose, you repay the loan by making…
A: let us see the answer:- Below I have written the code in c++ iostream: iostream is an abbreviation…
Q: Suppose you deposit a certain amount of money into a savings account that earns compound monthly…
A: The below-given javascript program will obey the following rubrics: Declaring a function,…
Q: CODE IN C++ Language: Given two sets of inputs: a time (two inputs: the first is the hour which is…
A: The C++ code is given below with code and output screenshot Happy Coding ?
Q: using a C++ program code the problem, The game of "23" is a two-player game that begins with a pile…
A: Hello student, hope you are doing good. This is a console game of human vs computer to be coded in…
Q: PRG12: Write a program that will simulate the Paper, Rock, Scissors game. Two players should be able…
A: ## As no language is mentioned, we write the code in Python language. print("\n\n…
Q: Write a program that simulates flipping a coin to make decisions. The input is how many decisions…
A: pass number of flips to function call heads_or_tails() iterate from i=0 to i<n call…
Q: An oil slick occurs when an underwater refinery pipe ruptures, pumping oil into the water. The…
A: Program: // include required header files #include <iostream> #include <iomanip>…
Q: Please help me solve this problem
A: Note: The Python program is coded as the user requirements.In Python, code indentation is very…
Q: Direction: Create a simple Java Program that will output the grades of 1 student in different…
A: Find Your Answer Below
Q: A company wants a program that will calculate the weekly paycheck for an employee based on how many…
A: #note: since the programming language is not specified, we are providing answer in python #reading…
Q: Using C++ Write a program that plays a dice game called "21" It is a variation on BlackJack…
A: According to the information given, We have to create a program of card game BlackJack Thea are 21…
Q: Write a program that simulates flipping a coin to make decisions. The input is how many decisions…
A: code : import random def heads_or_tails(): # call randint() to to select a number between 0…
Q: shows how to write a program to factor a polynomial of the form x² + bx + c, where b and c are…
A: #include <iostream>#include <cmath>using namespace std;int main() {float a, b, c, x1,…
Q: Suppose you have a certain amount of money in a savings account that earns compound monthly…
A: Here I have created a function that takes 3 input parameters, compute the future value and return…
Q: (b) In a crypto-arithmetic puzzle, a mathematical equation is written using letters. Each letter can…
A: Python Program: From itertools import combinations, permutations x = input("Enter the value of x: ")…
Q: Instructions Write a program to implement the algorithm that you designed in Exercise 19 of Chapter…
A: #include <iostream> using namespace std; int main() { float temp, n, totalPrize = 0;…
Q: Using Java programming language write a program to manage a hotel with 24 rooms; 10 rooms are…
A: It is defined as
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 program that reads the marks of a student in the test (te), midterm (mid), assignment…
A: I am uploading the handwritten solution in the next step. As there is no programming language…
Q: You are working for a lumber company, and your employer would like a program that calculates the…
A: Purpose of the program: This program computes the total cost of different types of lumber for an…
Q: Modify the guessing-game program so that the user thinks of a number that the computer must guess.…
A: The code given in the problem has no limitation on the number of guesses. As a result, until the…
Q: Question: 1 A perfect number is an integer that is the sum of its positive proper divisors (all…
A: Need to write Python program which accepts number from user till it encounters "STOP" and show the…
Q: Write the reading program: basic salary (bsalary) and sales (sales), then calculate and print the…
A: Here, first you need to declare some variables for all salaries. Then prompt user to enter basic…
Q: Use C++ Write a program that simulates flipping a coin to make decisions. The input is how many…
A: For generating head or tail we had used rand() function. Algorithm- 1) ask number of times coin to…
Q: When you borrow money to buy a house, a car, or for some other purpose, you repay the loan by making…
A: // iostream in C++ is the standard library which implement stream based input/output capabilities…
Q: Write a program that simulates flipping a coin to make decisions. The input is how many decisions…
A: According to the information given:- We have to preform flipping a coin to make decisions. take…
Q: Write a program that works out if a given year is a leap year This is how to workout whether if a…
A: Code: function leapYear_697(year){ return (year % 100 === 0) ? (year % 400 === 0) : (year % 4 ===…
Q: When you borrow money to buy a house, a car, or for some other purposes, then you typically repay it…
A: Actually, program is a executable software that runs on a computer.
Q: A company selling household appliances gives commissions to its salesman determined by the kind of…
A: import java.util.*; class GFG { public static void main (String[] args) { Scanner sc= new…
Q: Write the reading program: basic salary (bsalary) and sales (sales), then calculate and print the…
A: C++ program is given below
Q: An oil slick occurs when an underwater refinery pipe ruptures, pumping oil into the water. The…
A: Program code: // include required header files #include <iostream> #include <iomanip>…
Q: Write a program that lets the user play the game of Rock, Paper, Scissors against the com- puter.…
A: import java.util.Random;import java.util.Scanner; public class Main { public static int…
Q: Can you help me how to slove the program by C++, please ? The game of Pig The game of Pig is a dice…
A: uestion Can you help me how to slove the program by C++, please ? The game of Pig The game of Pig…
Q: on a C++ program and using loops code this problem, The game of "23" is a two-player game that…
A: Here I have created an infinite loop, and then input from the user for the choice to play the game,…
In Python
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- When you borrow money to buy a house, a car, or for some other purpose, you repay the loan by making periodic payments over a certain period of time. Of course, the lending company will charge interest on the loan. Every periodic payment consists of the interest on the loan and the payment toward the principal amount. To be specific, suppose that you borrow $1,000 at an interest rate of 7.2% per year and the payments are monthly. Suppose that your monthly payment is $25. Now, the interest is 7.2% per year and the payments are monthly, so the interest rate per month is 7.2/12 = 0.6%. The first months interest on $1,000 is 1000 0.006 = 6. Because the payment is $25 and the interest for the first month is $6, the payment toward the principal amount is 25 6 = 19. This means after making the first payment, the loan amount is 1,000 19 = 981. For the second payment, the interest is calculated on $981. So the interest for the second month is 981 0.006 = 5.886, that is, approximately $5.89. This implies that the payment toward the principal is 25 5.89 = 19.11 and the remaining balance after the second payment is 981 19.11 = 961.89. This process is repeated until the loan is paid. Write a program that accepts as input the loan amount, the interest rate per year, and the monthly payment. (Enter the interest rate as a percentage. For example, if the interest rate is 7.2% per year, then enter 7.2.) The program then outputs the number of months it would take to repay the loan. (Note that if the monthly payment is less than the first months interest, then after each payment, the loan amount will increase. In this case, the program must warn the borrower that the monthly payment is too low, and with this monthly payment, the loan amount could not be repaid.)Using C++ Dice game with varying dice (d4-d20) The game will consist of two or more players. Each player will attempt to reach a set number (say 100) By rolling dice and adding up the results of the dice roll. if the player rolls a certain number (in this case a 6) then the player gets two more tries, if they roll a 6 two more times, they lose their turn and gain no points that round. The goal to get to 100 first. During a round, each player takes a turn. At the beginning of the game, each player rolls a dice, with the higher roll going first each round. A player’s total score is the sum of their turn scores, the users will have the ability to choose either to stop or to continue after first roll, if a player decides to stop, then their turn ends and their score for that turn is their maximum roll during that turn, if the player decides to continue, they roll the dice again. At the end of the game the program should display the winner your program should have at least four of…Interest on a credit card’s unpaid balance is calculated using the average daily balance. Suppose that netBalance is the balance shown in the bill, payment is the payment made, d1 is the number of days in the billing cycle, and d2 is the number of days payment is made before billing cycle. Then, the average daily balance is: averageDailyBalance = (netBalance * d1 – payment * d2) / d1 If the interest rate per month is, say, 0.0152, then the interest on the unpaid balance is: interest = averageDailyBalance * 0.0152 Instructions Write a program that accepts as input netBalance, d1, payment, d2, and interest rate per month (interestRate). The program outputs the interest. Format your output to two decimal places. Input: 100 30 50 7 9.7 Output: 856.83 Test case 2: Input: 255.76 31 55 3 12.3 output: 3080.38
- Interest on a credit card’s unpaid balance is calculated using the average daily balance. Suppose that netBalance is the balance shown in the bill, payment is the payment made, d1 is the number of days in the billing cycle, and d2 is the number of days payment is made before billing cycle. Then, the average daily balance is: averageDailyBalance = (netBalance * d1 – payment * d2) / d1 If the interest rate per month is, say, 0.0152, then the interest on the unpaid balance is: interest = averageDailyBalance * 0.0152 Write a program that accepts as input netBalance, d1, payment, d2, and interest rate per month (interestRate). The program outputs the interest. Format your output to two decimal places.Write the pseudocode for the following scenario: A manager at a 2nd hand car dealership wants to keep track of the amount (in Rands) of commission paid to the sales people. You must take the following into consideration: • There may be more than one salesperson (each salesperson has a unique employee code)– input the employee code. An employee code of zero (0) terminates the program. • The salesperson’s commission is based on their sales (in Rands) in the past month- input the sales for each salesperson. • Calculate the total car sales (in Rands). • Calculate a salesperson’s commission (in Rands). Commission is based on the following table: Total value of cars sold Percentage commission earned Less than or equal to R500 000 10% More than R500 000 15% • Calculate the total commission the manager must pay to all of the salespeople. • Display a report for the manager in the following format: Employee Code: 2 Sales: R400000 Commission: R40000 Employee Code: 4 Sales: R650000…Using C++ Write a program that plays a dice game called "21" It is a variation on BlackJack where one player plays against the computer trying to get as close to 21 as possible without going over. Here are the rules of the game: You will play with dice that have numbers from 1 to 11. To win, the player or the computer has to get to 21, or as close as possible without going over. If the player or computer goes over 21, they instantly lose. If there is a tie, the computer wins. Starting the game: The player is asked to give the computer a name. For now, we'll simply call the computer opponent, "computer." The game starts with rolling four dice. The first two dice are for the player. These two dice are added up and the total outputted to the screen. The other two dice are for the computer. Likewise, their total is outputted to the screen. Player Loop: If a total of 21 has been reached by either the player or the computer, the game instantly stops and the winner is…
- 4) 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% Calculateplz solve it asap ????????: Write a program for a game that consists of two players. The rule of the game is that player 1 inputs a random number from 1-100. Player 2 will input 5 numbers. If the summation of those numbers is equal to the number OR less than or greater than the number by 3 (+3 or -3), then player 2 wins. Otherwise, player 1 wins. Test Case 1 Input Player 1, enter a number: 50 Player 2, enter a number: 10 Player 2, enter a number: 10 Player 2, enter a number: 20 Player 2, enter a number: 5 Player 2, enter a number: 7 Output Player 2 wins Explanation: The summation of 10,10,20,5 and 7 is 52 which is greater than 50 by 2. According to the rule, player 2 wins. Test Case 2 Input Player 1, enter a number: 50 Player 2, enter a number: 10 Player 2, enter a number: 10 Player 2, enter a number: 20 Player 2, enter a number: 5 Player 2, enter a number: 1 Output Player 1 wins Explanation: The summation of 10,10,20,5 and 1 is 46 which is less than 50 and also doesn’t…Arranging Pebbles Write a program that can arrange a group of pebbles into its designated position. We have 4 types of pebbles: Red, white, blue, and green colored pebbles. Supposed that we have an n-number of pebbles, the program should be able to check the color of the pebble and arrange them in such a way that it will look something like this: Example, if there are 9 pebbles; 1 green, 3 white, 2 blue, and 3 red, the program will output something like this: RRRWWWBBG
- Arranging Pebbles Write a program that can arrange a group of pebbles into its designated position. We have 4 types of pebbles: Red, white, blue, and green colored pebbles. Supposed that we have an n-number of pebbles, the program should be able to check the color of the pebble and arrange them in such a way that it will look something like this: Example, if there are 9 pebbles; 1 green, 3 white, 2 blue, and 3 red, the program will output something like this: RRRWWWBBG NOTE: The program will let the user to enter the pebbles and then the program will automatically arrange it. Sample output 1: R=Red, W-White, B=Blue, G=Green Enter pebbles: rwgbrgwbrg Arranged pebbles: RRRWWBBGGG Sample output 2: R=Red, W-White, B=Blue, G=Green Enter pebbles: abcde Invalid input Notice that the arrangement of the pebbles is: Red, White, Blue, GreenJAVA CODE PLS Rectangle by CodeChum Admin A rectangle can be formed given two points, the top left point and the bottom right point. Assuming that the top left corner of the console is point (0,0), the bottom right corner of the console is point (MAX, MAX) and given two points (all "x" and "y" coordinates are positive), you should be able to draw the rectangle in the correct location, determine if it is a square or a rectangle, and compute for its area, perimeter and center point. To be able to do this, you should create a class for a point (that has an x-coordinate and a y-coordinate). Also, create another class called Rectangle. The Rectangle should have 2 points, the top left and the bottom right. You should also implement the following methods for the Rectangle: display() - draws the rectangle on the console based on the sample area() - computes and returns the area of a given rectangle perimeter() - computes and returns the perimeter of a given rectangle centerPoint() -…Summary Interest on a credit card's unpaid balance is calculated using the average daily balance. Suppose that netBalance is the balance shown in the bill, payment is the payment made, d1 is the number of days in the billing cycle, and d2 is the number of days payment is made before billing cycle. Then, the average daily balance is: averageDailyBalance = (netBalance * d1 payme If the interest rate per month is, say, 0.0152, then the interest on the unpaid balance is: interest averageDailyBalance * 0.0152 Instructions Write a program that accepts as input netBalance, d1, payment, d2, and interest rate per month ( interestRate).