public class homework8_2 public static void main(String [] args) { Scanner keyboard = new Scanner(System.in); int selections = 0; DecimalFormat formatter = new DecimalFormat("#0.0000"); do { showMenu(); selections = keyboard.nextInt(); System.out.println("please input the amount of meters"); double meters = keyboard.nextDouble(); if (selections == 1) { double kilometers; kilometers = showKilometers(meters); System.out.println("Kilometers = " + kilometers); } else if (selections == 2) { double inches = 0; inches = showInches(meters); System.out.println("inches = " + inches); } else if (selections == 3) { double feet = 0; feet = showFeet(meters); System.out.println("Feets = " + feet); } }while (selections != 4); } public …

Member Avatar
Member Avatar
+0 forum 6

This program ask user which arithmetic operation they want to play with then generates a random equation and lets the user answer it. When the user stop playing the game the program calculates the number of correct and answers and wrong answers. I need some help because the program crashes when doing divisions. [CODE]#include <iostream> #include <fstream> #include <string> #include <cstring> #include <cmath> #include <cstdlib> #include <iomanip> //include header file #include "lab_17_head.h" using namespace std; int main( ) { //variable declaration int number1, number2; //vars to store int values double intResult, doubleResult, result; //vars to store the result char action; …

Member Avatar
Member Avatar
+0 forum 19

How do i call back a variable in void method into the main method?? [CODE]public void multiply (int x) { Vector3 v3 = new Vector3(num1*x,num2*x,num3*x); }[/CODE]

Member Avatar
Member Avatar
+0 forum 6

Well, I've been Googling for at least 30 minutes, and looking through past posts about this, but just can't seem to find an answer that works. Basically, I've got a component class that has a single method I'm trying to test out. The entity class has a private array of these components (actually, it's an array of void*, but I cast to the appropriate type when getting the component from the array). So when I call the method it looks like this: [code]((Component*)myEntity.getComponent(Base))->testFunction();[/code] This is the error I'm getting: 1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall GE::Component::Component(void)" (??0Component@GE@@QAE@XZ) …

Member Avatar
Member Avatar
+0 forum 1

I am trying to make a form using html and JSP, get the data and save them in an XML file. I use also Tomcat 1.6 as server. For generating the XML I am using the XStream library. I have a Customer.java class with get and set methods for a message and an email. Then I have a GenerateXml.java file which creates a Customer object, get the data and add them in an XML file: [code=Java]Customer customer = new Customer(); customer.getMessage(); customer.getEmail(); XStream xs = new XStream(); try { FileOutputStream fs = new FileOutputStream("C:\\customers.txt"); xs.toXML(customer, fs); } catch (FileNotFoundException e1) …

Member Avatar
Member Avatar
+0 forum 1

Okay, I'm making a shooter game, and all my weapons are differnt userdefined objects; ie. the flamethrower works differently then the gun, however, I'm calling some functions in my "main", an example of this would be; [CODE] /* <Init> */ MachineGunClass *CurrentWeapon; MachineGunClass *MachineGun; MachineGun = new MachineGunClass(); CurrentWeapon = MachineGun; /* </Init> */ /* <Usage> */ /* Lots of code */ CurrentWeapon->Shoot(); /*More code */ /* </Usage> */ [/CODE] So this works as it should, however let's say I wanted to use my flamethrower, to change to that weapon I would call the following; [CODE] FlameThrowerClass *FlameThrower; FlameThrower = …

Member Avatar
Member Avatar
+0 forum 8

I need to finish this program, but i have no idea how to! please help me figure this out. [code] #include <iostream> #include <fstream> using namespace std; void printShips(char [15][15]); void fire(int row, int col, char ocean[15][15], char &result, char &ship); struct counter { int B, C, D, F, T, S; }; int main() { ifstream myin; char ocean[15][15]; char battle[15][15]; int i,j; char trash; int missles = 30; bool won = false; int row, col; char result, ship; counter counters; //Initialize the counters counters.B = 4; counters.C = 5; counters.D = 3; counters.F = 2; counters.S = 3; counters.T …

Member Avatar
Member Avatar
+0 forum 11

The End.