[solved] – Question 8158
When writing a program in java, is it possible to call a method from its own class?
Expert Answer
[solved] – Question 81587
2. The value of p can be approximated by using the following series:
–
¼ 4 1 1
3 þ
1
5 1
7 þþ
1
2n 1 þ
1
2n þ 1
:
The following program uses this series to find the approximate value of p. However,
the statements are in the incorrect order, and there is also a bug in this program.
Rearrange the statements and also find and remove the bug so that this program can
be used to approximate p.#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
double pi = 0;
long i;
long n;
cin >> n;
cout << “Enter the value of n: “;
cout << endl;
if (i % 2 == 0)
pi = pi + (1 / (2 * i + 1));
else
pi = pi – (1 / (2 * i + 1));
for (i = 0; i < n; i++)
{
pi = 0;
pi = 4 * pi;
}
cout << endl << “pi = ” << pi << endl;
return 0;
Expert Answer
[solved] – Question 81593
// Continue playing as long as the game is not over
// (a team does not have a score of 15 or more
// with a difference of at least 2)
while (!((buffstate >= 15 || notredame >= 15) && (buffstate – notredame <= 2 || notredame – buffstate >= 2)))
Im not sure if my boolean expression is correct? The program executes, however its not following the (difference of at least 2 for the score)
Expert Answer
[solved] – Question 81630
design a program in for Bob’s E-Z Loans. The Application accepts a client’s loan amount and monthly payment amount. Output the customer loan balance each month till it’s paid off.
Expert Answer
[solved] – Question 81669
For this project you will be designing and implementing a system, in either C or C++,to answer a few mathematical questions. First, given the number 123456789, is it possible to find a permutation (i.e. a rearrangement that preserves the count of each number) such that the left most digit is evenly divisible by 1, the two left most digits are evenly divisible by 2, the three left most digits are divisibly by 3 and so on?For example, in 123456789, 1 is evenly divisible by 1, 12 is evenly divisible by 2, 123 is evenly divisible by 3, but because 1234 is not evenly divisible by 4 this number is not a solution to the question.Second, is itpossible to find a similar permutation given the number 1234567890?Finally, is it possible to find a similar permutation for any of the given hexadecimal numbers, 1234567890AB, 1234567890ABC, 1234567890ABCD, 1234567890ABCDE, 1234567890ABCDEF?
Expert Answer
[solved] – Question 81673
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int num;
do
{
cout << “Enter an integer: “;
cin >> num;
cout << “nNumber: ” << num;
if (num > 0)
cout << “nMagnitude: Positive”;
else if (num < 0)
cout << “nMagnitude: Negative”;
else
cout << “nMagnitude: Zero”;
if (num % 2 == 0)
cout << “nType: Even”;
else
cout << “nType: Odd”;
cout << “nn”;
}
while ();
return 0;
}
So I want the program to terminate the loop when the user enters a negative odd integer but I’ve been struggling to find the correct expression to fit.
Expert Answer
[solved] – Question 81708
Write a program that inputs the length of two pieces of fabric in feet and inches (as whole numbers) and prints the total.
Enter the Feet for the first piece of fabric: 3
Enter the Inches for the first piece of fabric: 11
Enter the Feet for the second piece of fabric: 2
Enter the Inches for the second piece of fabric: 5
It displays:
Feet: 6 Inches: 4
HOW TO GET THE RIGHT CODE???
print (“Enter the Feet for the first piece of fabric: 11”)
print (“Enter the Inches for the first piece of fabric: 11”)
print (“Enter the Feet for the second piece of fabric: 5”)
print (“Enter the Inches for the second piece of fabric: 5”)
print (“Feet: 17 Inches: 4”)
print (“Enter the Feet for the first piece of fabric: 4”)
print (“Enter the Inches for the first piece of fabric: 5”)
print (“Enter the Feet for the second piece of fabric: 7”)
print (“Enter the Inches for the second piece of fabric: 6”)
print (“Feet: 11 Inches: 11”)
Expert Answer
[solved] – Question 81760
Adam regularly challenges one of his teachers to a pool competition. The winner of their matches is the person who wins the most individual games of pool.
Adam wishes to write a computer program to calculate the total number of times each player wins a game and display a message congratulating the winner of the overall match.
a) Adam wants the program to:
•repeatedly ask the user to input the winner of each game
•stop asking for input when the character “X” is entered
•add up the number of wins for each player as the winner of each game is inputted
•display a message congratulating the player who won the most games or display a message saying that the match was tied.
Write a program below that meets Adam’s requirements.
Expert Answer

