Member Avatar

Dear all sir, i'm a begining of java and i have a problem to write the equation in java code , i want to make it in for loop and i also want to count it by column.how do i do? please me!!! example: f[1][1]=5.4; f[2][1]=5.0; f[3][1]=1.5; k[1][1]=|f[1][1]-f[2][1]|+|f[1][1]-f[3][1]-|; k[2][1]=|f[2][1]-f[1][1]|+|f[2][1]-f[3][1]-|; k[3][1]=|f[3][1]-f[1][1]|+|f[3][1]-f[2][1]-|;

Member Avatar
0
5
Member Avatar

I am stuck in this code. I have to print results every 30 tosses for 500 total tosses. I made the 30 but in the loops. And also percentages are showing as 0 Help or hints would be much appreciated. [CODE]import java.util.Random;// program uses class Random public class CoinTossing { public static void main (String [] args) { Random coinTosses = new Random(); System.out.println("START Coin Toss!"); int frequencyHeads=0;//maintains count of heads rolled int frequencyTails=0;//maintains count of tails rolled int percentageH; int percentageT; int totalTosses; for (int toss = 1; toss <= 30; toss++) { int face = coinTosses.nextInt(2); if (face …

Member Avatar
0
7
Member Avatar

Hi, The whole idea of this program is allow teachers to input marks results for 6 students. Once all marks have been entered, It must to display the marks and grade for each student. For some reason it can't display the grade properly. It just display "Fail" on each mark. If somebody can help me, I'd appreciate. Thank you. [CODE]import java.util.Scanner; public class ExamMarks { public static void main(String[] args) { int marks = 0; String g = ""; int[] sNumb = new int[6]; Scanner scan = new Scanner(System.in); for (int i = 0; i < sNumb.length ; i++) { …

Member Avatar
0
4
Member Avatar

Ok so i have trouble with looping with while and for statments heres the questions: 1. Write a program that gets a positive integer from the user and prints all the numbers from one to that integer. If the inputted number is zero or negative, then the program will print an error and quit. I dont have much, but this is all i have: [CODE]#include <iostream> using namespace std; int main() { int num=1, i; cout<<"please enter a number"<<endl; cin>>i>> while num<i; cout<< num+1<<; return 0; }[/CODE] Can someone please to me what to add and the correct format

Member Avatar
0
10
Member Avatar

Hello, Despite much searching, I've hit a wall with trying to get a varying number of records inserted into a database. Here's what I'm trying to do..... I'm building an online sign on site for races at a sailing club. For the sign on page, I want to make it possible for racers to sign on for either one or all the races happening on a day. Here's the form..... [CODE] <form action="" method="post" name="form1" id="form1"> <table align="center"> <tr valign="baseline"> <td nowrap="nowrap" align="right">Helm:</td> <td><select name="helm"> <option value="">Please Select....</option> <?php do { ?> <option value="<?php echo $row_sailors['name']?>"><?php echo $row_sailors['name']?></option> <?php } …

Member Avatar
0
8
Member Avatar

I have a program where it reads 2 files, one of them containing a file with customer number (int), customer name (string) and balance (double). There are 7 lines, but my program would only read the first line 7 times. This program is confusing me as to why they won't update. [CODE]#include <iostream> #include <fstream> #include <string> #include <iomanip> #include <cmath> using namespace std; int main () { int Mcust_num; //master customer number string Mcust_name; //master customer name string Mlast_name; double Mcust_bal; //master customer balance string line; char Tcode; //transaction code type int Tcust_num; //transaction customer number string Titem_name; //transaction …

Member Avatar
0
19
Member Avatar

[CODE]#include <iostream> using namespace std; int main() { int sum = 0; // Declare an int variable sum to accumulate the numbers int lowerbound; // Set the initial sum to 0 int upperbound; // Sum from 1 to this upperbound // Prompt user for an upperbound cout << "Enter a integer: "; cin >> upperbound; cout << "Enter another integer: "; cin >> lowerbound; while (lowerbound <= 100 && upperbound <= 100) { sum = sum + upperbound++ + lowerbound++; } // Print the result cout << "The total of the numbers " << upperbound << " and " << …

Member Avatar
-1
24
Member Avatar

I TRY TO MAKE CODE COUNTER WITH CODE [B]MR/IR/001[/B] IN MY APPLICATION USING VISUAL BASIC 2008, BUT WHEN THE CODE GET [B]MR/IR/999[/B] IT`S STUCK AND NOT INCREASING, I WANT TO MAKE THE CODE INCREASE TO : MR/IR/1000 MR/IR/1001 MR/IR/1002 MORE AND MORE ... FOR DATABASE I`M USING MS ACCESS 2007 PLZ HELP ME... ------------------------------------------------------------------------------------ [code]Dim strTemp As String = "" Dim strValue As String = "" Dim sql As String sql = "SELECT * FROM DETAILPERIKSA ORDER BY IDPERIKSA DESC" cmd = New OleDbCommand(sql, Conn) dtReader = cmd.ExecuteReader If dtReader.Read Then strTemp = Mid(dtReader.Item("IDPERIKSA"), 7, 4) Else TxtDETAILTRANS.Text = "MR/IR/001" …

Member Avatar
0
10
Member Avatar

Hi All ~ So the program actually compiles without using arrays or global variables, outputs the correct user input, however average score and lowest score values that compute are wrong. I have no idea where the heck I'm messing up but I am hoping you can help me. The findLowest module works in that it outputs the last number entered by the user. calcAverge outputs the average of the last score alone. I guess I need to know where to put the accumulator for calcAverage and whether I should take a different approach altogether. I am soooooo.....close to having this …

Member Avatar
0
6
Member Avatar

what codes in JAVA to have an output program like this: 123 12 1 help me..

Member Avatar
-1
5
Member Avatar

I am attempting to create code where the user can alter the A elements in the list continuously. If another letter in the list is replaced however, it should ask for new input from the user, and go back to the code where the user can alter A elements in the list. My code isn't working however. I am new to coding, so please don't explain things in a complicated manner. I need help! Here is my code: [CODE] list = [['A', 'B', 'A'],['C', 'D', 'B']] print m f=input("Index for sublist ") g=input("Index for sublist item ") def errordetection (): …

Member Avatar
0
11

The End.