No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
I wanted to know how i can print the purhcase that the user got. Thank you. import java.util.Scanner; public class VendingMachine { private double chips; private double cookies; private double soda; private double gum; private double candy; private double energyDrink; private Scanner kb; private int dollar; private int quarters; private … |
|
I need help with my getName method. The error message is invalid method declaration, return type required. And i don't know how to write a method to change the canidate's name. Thank you in advance. /** * Class to create a Candidate object * * @author la * @version 4/21/07 … |
|
My code compiles but it has a java null error. import java.util.Arrays; public class Example { private int[] NumberArray; public Example() { int[] NumberArray = new int[4]; } public void setNumberArray() { NumberArray[0] = 20; NumberArray[1] = 15; NumberArray[2] = 22; } public void printnumberArray() { for(int index=0; index < … |
|
i'm writing a cashier like program and i need help with the setfill code. i wrote "cout << "Item Cost: " << setw(8) << cost << setw(10) << setfill('=') << endl;" and the result is "Change Due: ======5" I want the equal sign to be on the next line all … |
|
Please enter your starting balance: 200 What would you like to do? B...Show Balance D...Deposit W...Withdrawal Q...Quit B Your balance is 200.000000 Press any key to continue . . . i put my set precision to 2 and it's printing 6 zeros. how come? |
|
my code freezes whenever i enter 12-19. #include <cmath> #include <iostream> using namespace std; int main() { int multiples; int answer; int square; int cube; int num; cout << "Please enter a positive number less than or equal to 20: ";\ cin >> num; do { if(num >=20) cout << … |
|
hi i have two question? if i wanted to read in file also, how do i do that? #include <conio.h> #include <iostream> #include <cstring> #include <ctype.h> #include <string> using namespace std; using std::string; enum CardType{ MasterCard, BankCard, Visa, AmericanExpress, Discover, DinersClub, JCB }; bool Validate(CardType cardType, string cardNumber){ int number[16], … |
|
can someone help me, my code won't compile. #include <iostream> #include <string> using namespace std; int main() { int hi, lo, mid; bool found; char status, reply; do { cout << "Think of a number between 0 and 1000" << endl; cout << " Write it down, I will guess … |
|
this loop is running more times then i want to and when the user puts in the wrong number how do i print out an error. #include <iostream> #include <iomanip> #include <cmath> using namespace std; int main() { string answer; int soda; do { cout << "Choose a drink or … |
|
#include <iostream> #include <iomanip> #include <cmath> using namespace std; int main() { int soda; cout << "Choose a drink or 6 to quit:"; << endl; cout << "1. Coke $1.00"; << endl; cout << "2. Water Free"; << endl; cout << "3. Sprite $1.25"; << endl; cout << "4. Dr. … |