So I have a poker type program where it should shuffle and deal a deck of cards using arrays of pointers. I have to write a function that uses a pointer(s) to determine if the hand contains an Ace. If I can understand this one, I'd be able to do the rest with no problems. I was told to do what I did with int decks, int dealt, int the_hand, but I keep getting errors. I've been trying everything I could think of, but no luck. Am I even in the right direction? Also, I read the book, reviewed my …

Member Avatar
Member Avatar
+0 forum 12

Hey everyone. I really need help with a question in Python. I have been trying for several days to figure this out. Any help will be much appreciated! Here is the question: Body Mass Index (BMI) is a good indicator of boy fatness for most people. The formula for BMI is weight/height^2 where weight is in kilograms and height is in meters. Write a program that prompts for weight in pounds and height in inches, converts the values to metric, and then calculates and displays the BMI value. I know what I have is absolutely wrong and I have no …

Member Avatar
Member Avatar
+0 forum 1

Hello! My friend recommended that I try this site if I needed advice on my programs, so I thought 'hey, why not?'. I'm working on a program that is to draw shapes and store them in arrays. I kinda can't figure out how to make my print functions work correctly. I also don't know what I'm doing wrong when trying to add in the information. Any advice on what to do next would be absolutely wonderful! [CODE]package arraydrawer; * Description: * This program takes input and puts it into an the shape array specified. * The two shapes available are …

Member Avatar
Member Avatar
+0 forum 2

So my instructor assigned us to create a program that calculates the area and stores that, along with coordinates, in an array. This has to be done for both triangles and squares. He is having us use separate classes for the project; the main Drawer class, parent class, square class, and triangle class. I've got a portion of it done, but I'm honestly not sure where I need to go from here. I can't seem to figure out how to get the information read from the main part of the program into the methods that I have and I don't …

Member Avatar
Member Avatar
+0 forum 15

I am working on a project of converting VB code to C# code and I am lost as to how to read data from a prompt in C#. Here is the snippet I am concerned with fixing, but below I will post the entire code. [CODE] private void Button1_Click(System.Object sender, System.EventArgs e) { string Prompt = null; decimal[] Tests1 = null; NumTest1 = Convert.ToInt16(txtTest1.Text); Array.Resize(ref Tests1, NumTest1); short i = 0; Prompt = "Please enter grade scores one at a time"; for (i = 0; i <= Tests1.Length; i++) { Tests1[i] = Convert.ToInt16(Prompt.ToString); Total1 = Total1 + Tests1[i]; textBox1.Text = …

Member Avatar
Member Avatar
+0 forum 5

I would like to start this post off with, I am not looking for someone to do my homework for me. If I was looking for someone to "do it for me", I would go to one of the sites where you can pay someone to do your work for you. I am trying to learn VB and C#. This is a VB.Net assignment. However, I am looking for guidance or someone to point out my errors (and there are SEVERAL of them from the odd results my game is producing. I am going to paste the assignment requrirements, then …

Member Avatar
Member Avatar
+0 forum 2

the program runs but fails to read the double word states (e.g New Jersey). am getting the error.java.lang.NumberFormatException: For input string: "Hampshire" [CODE] import java.text.DecimalFormat; import java.util.*; import java.io.*; import java.lang.reflect.Array; import java.nio.CharBuffer; import java.awt.*; //import java.awt.event.*; import javax.lang.model.type.ArrayType; import javax.swing.*; import javax.swing.event.*; public class PJ5 extends JFrame implements ListSelectionListener {String []States = new String[100]; double []statetax = new double[100]; double sales; JPanel p1; JList StateList; JTextField salesField; private JTextField taxField; public static void main(String []args) { PJ5 x = new PJ5(); x.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); x.setTitle("Sales tax calculator"); x.setSize(350, 250); x.setVisible(true); } // main public PJ5() // constructor { String s; StringTokenizer …

Member Avatar
Member Avatar
+0 forum 1

I'm trying to find max and min values from a text file which contains data in rows and columns. But I want to create a script which will skip the first couple of lines and calculate the max and min from there on. I am aware for the max and min functions in Python, but I'm not sure how to specify the range. I know I can do something like the following: [CODE] f = open('data.txt', 'r') # Open file data = f.readlines() # Read lines in the file for range(2,...): # Define the range. Is there a way to …

Member Avatar
Member Avatar
+0 forum 3

I need to write a code to find greatest common factor of two numbers but I have no idea how? any help? please.

Member Avatar
Member Avatar
+0 forum 1

I have to write a code that will print out the sum of all numbers between 1 and 100 that 7 and 5 go into evenly. I can't really think of how to write it. This is what I have but it doesn't work.[CODE] import java.io.*; public class work {public static input in = new input(); public static void main(String[] args) throws IOException { int sum; sum = 0; for (int x=1;x<=1000;x=+1) if (x%5==//x%7==0){ sum=sum+1}; System.out.println(sum); } }[/CODE]

Member Avatar
Member Avatar
+0 forum 6

So I have this code that has a sum function that sums n elements in a vector [CODE]#include <iostream> #include <vector> // need this in order to use vectors in the program using namespace std; void computeSum (vector<int> &Vec, int howMany, int total, bool success) //the computeSum function that will sum positive numbers in a vector { int j; total=0; for(j=0;j < howMany;j++) if (Vec[j] > 0){ total+=Vec[j]; } else { total+=Vec[j+1]; } if (howMany > Vec[j]) success = false; else success = true; if (total != 0) success = true; if (success=true){ cout << total; } else { cout …

Member Avatar
Member Avatar
+0 forum 8

So here is my code for a sum function for a vector - using boolean success to just pretty much catch simple errors and what not However when I compile it says that success is undeclared in my int main() and I was just wondering how to properly declare it in my main function I know having success is kind of annoying - but it needs to be there [CODE]#include <iostream> #include <vector> // need this in order to use vectors in the program using namespace std; void computeSum (vector<int> &Vec, int howMany, int total, bool success) //the computeSum function …

Member Avatar
Member Avatar
+0 forum 2

Instructions: --For each day, tell which balloon (identify it by time released) traveled the greatest distance on that day (7 values printed). Identify the day by name rather than by number. --For each day, calculate and print the average distance (print one decimal position) traveled by all balloons released on that day which were actually recovered hose for which distance > 0) (7 values printed). Identify the day by name rather than by number. --Calculate and print the average distance (print one decimal position) traveled by all the balloons which were recovered during the entire week (1 value printed). --I …

Member Avatar
Member Avatar
+0 forum 5

Create a program that is a Point of Sales (POS) system for a restaurant. Your POS system should allow unlimited orders from any number of guest. Each guest should be able to order a drink, an appetizer, an entree, and a dessert. The program should present a total. In addition, the program should allow user to add to the order, delete from the order, and separate orders. Creativity is advised. This is the current project that I have been assigned and I have no clue where to even start it. We have briefly covered arrays and I am not sure …

Member Avatar
Member Avatar
+0 forum 16

Im having trouble with this program. I attached a picture of what is required. Thanks for any pointers you guys :) p.s. I'm very new to this.

Member Avatar
Member Avatar
+0 forum 6

Exception in thread "main" java.lang.IllegalArgumentException: Cannot format given Object as a Number at java.text.DecimalFormat.format(DecimalFormat.java:487) at java.text.Format.format(Format.java:140) at McVrideMortgageCalculator.Main.main(Main.java:69) The above statement is the error that occurs when running code. [CODE]package McVrideMortgageCalculator; import java.text.*; //Allows text formatting and used for formatting currency in this program public class Main { public static void main(String[] args) { double dblPrincipal = 200000; //principal amount double [] dblInterestRate = {5.35,5.5,5.75}; //intialized the array with values(interest rate) int []intLoanTermYear = {7,15,30}; //intialized the array with values(loan term) double [] dblMonthlyPayment = {0,0,0}; //intialized the array with zero values(monthly payment) double [] dblMonthlyInterestRate= {0,0,0}; //intialized the array …

Member Avatar
Member Avatar
+0 forum 2

Ok so i have to write a program called hailstone numbers. Its basically asking the user to enter a number and if its even divide it by 2, if its odd multiply it by 3 and add 1 and then output the number of iterations. I made my program but I have a problem. The series keeps going and doesn't stop. Here's my program - [code=c] #include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) { int number = 0; int numIterations = 0;// number of iterations taken to reach 1 cout << "Enter a number:" << …

Member Avatar
Member Avatar
+0 forum 4

Write a program that reads in a sentence of up to 100 characters and outputs the sentence with spacing corrected and with letters corrected for capitalization. In other words, in the output sentence, all strings of two or more blanks should be compressed to a single blank. I don't know how to compress multiple blank spaces to one blank space. But my other functions work. Please help me with my deleteSpaces function! [CODE] #include <iostream> #include <cstdlib> #include <cctype> using namespace std; /**************************************************************************** Program: Ch8-1 Purpose: Fix sentences. ****************************************************************************/ const int MAX = 101; void clearPhrase(char p[], int &size); void …

Member Avatar
Member Avatar
+0 forum 2

HI, i am Nishank and have got a project -to make periodic table by using the following a. Data Structure b. Object Oriented Programming in C++ c. Data File Handling through the program the user should be able to: a.view the periodic table b.edit the periodic table c.delete a record d.quit can anyone help me with it i have made a file and here is the attachment i am using turbo c++ as the compiler While compiling it is showing me no error but while running it is showing the following errors: Linking PERIDIC.EXE: Linker Error: Undefined symbol _circle in …

Member Avatar
Member Avatar
+0 forum 1

Hi All, First of all Here is the question and what I have done so far. A) The helper method boolean isVowel (char c) should return true if the character it recieves is an uppercase or lowercase English vowel. For Our purposes, Vowels are the letters a, e, i, o, and u. The metod should do this by checking if the character c is contained in a string composed of vowel characters. B) The public String shorthand(String in) method should use the class StringBuilder to build an output string by appending non-vowel characters from its argument in to the result …

Member Avatar
Member Avatar
+0 forum 5

We got to get this to compile and I really need your assistance! I got sick last week and missed the lecture on these subjects and it took all night but here it is..... almost done.... but the assignment specs below say that it HAS TO COMPILE OR I FAIL! [code]#include<cstdlib> #include <process.h> #include<ctime> #include <iostream> using namespace std; // FACE CARDS ARE DEFINED WITH ENUMERATION. enum Suit { clubs, diamonds, hearts, spades }; const int jack = 11; //from 2 to 10 are const int queen = 12; //integers without names const int king = 13; const int ace …

Member Avatar
Member Avatar
+0 forum 2

Hey everyone.I am doing bachelors in software engineering and now am in my final year.and need a good idea for my final year degree project.so any good idea.....please do write in detail....waiting for a positive reply

Member Avatar
Member Avatar
+0 forum 16

The assignment is to design a program that determines the gross pay for each employee. Everything seems to work, but when you input more than 40 hours, it doesn't calculate overtime. Another thing is that, i can't get a message to pop up when someone input an invalid input. I can use an invalid exception, but I want to know why the if statement isn't working. class OverTime { public: OverTime (float = 0, float = 0); void sethoursWork(float); void sethourlyRate(float); float gethoursWork(); float gethourlyRate(); float getsalary(); private: float hoursWork; float hourlyRate; }; #include "stdafx.h" #include "OverTime.h" OverTime::OverTime(float a, float …

Member Avatar
Member Avatar
+0 forum 10

The End.