Can someone tell me what is the purpose of the block in the middle of the main method ? what do you call such action ?
public class test {
private static int i = 0;
private static...
Type: Posts; User: UniverseCloud
Can someone tell me what is the purpose of the block in the middle of the main method ? what do you call such action ?
public class test {
private static int i = 0;
private static...
i just found it x-x..
problem was in the outer loop x-x(from i >= 0 to i < 5), i just realized that the program was actually just running the inner loop once and leaving the other array values as...
(Financial tsunami) Banks lend money to each other. In tough economic times,
if a bank goes bankrupt, it may not be able to pay back the loan. A bank’s
total assets are its current balance plus its...
I could barely see it..
I changed the outer loop to be (int i = 1; i <= 100; i++).
works like a charm now.
thanks!
P.S i got to add, adding print statements helped a lot : i didn't know...
So here's the question:
(Game: locker puzzle) A school has 100 lockers and 100 students. All lockers are
closed on the first day of school. As the students enter, the first student, denoted
S1,...
yah i did it manually and the same result from the program...
everything seems to be in order.
Honestly i just assumed so, when a publisher publishes his 10th book you'd automatically think its...
Sorry for late reply.
Book output:
Feet
65.574 // << +0.006
81.967 // << +0.008
...
Book answer:
Feet Meters | Meters Feet
1.0 0.305 | 20.0 65.574
2.0 0.610 | 25.0 81.967
...
9.0 2.745 | 60.0 196.721
10.0 3.050 | 65.0 213.115
It's a very small difference but unsettling, i checked the code and both are practically the same (intro to java (10th))
The question is to display the values next to each other as you can see in...
im studying from a book called "intro to java programming(10th edition)" it seems easy and all until i try to make a method, i just end up keeping them all in the main method.
Is there any good...
I thought long and hard at the time, i kept going through the other questions but i couldn't continue and got frustrated to so i went to redo chapter 3/4/5 and back to the question and noticed that i...
/*
(Count positive and negative numbers and compute the average of numbers) Write
a program that reads an unspecified number of integers, determines how many
positive and negative...
Well, i was using an online compiler to run this program and it seems that the compiler didnt accept scanner ?? so recently i got my laptop back and wrote the program on dr.java and it worked! It was...
Sorry for the late reply! Been on and off on this question (Dont know why the its still giving me an error, a new one)
Like, i got the else if part right but when it comes to both together to be...
Here is there errors and the full code:
2 errors found:
File: C:\Users\omar-\Desktop\java learning\ChapterThree.java [line: 17]
Error: The operator && is undefined for the argument type(s)...
So the exercise tells me to get the values a, b and c from the user and then use the quadratic formula to get both roots.
if both are above 0, display both roots
if both are 0, display 1 root
if...
I've been reading this book and it had this code.
27 double totalPayment = monthlyPayment * numberOfYears * 12;
28
29 // Display results
30 System.out.println("The monthly payment is $" +
31...
I am fairly new and know my way around java but i want some kind of work ( or assignment ) to test myself, do you guys know of any good site that does such things ?
Sorry for the late reply!
double d = Math.PI*(Math.sqrt(7));
System.out.printf("%5.6f", d);
P.S if i removed the multiplication sign and used "double d =...
It just says Method call expected with this error
Error:(10, 24) java: cannot find symbol
symbol: method PI(double)
location: class java.lang.Math
PI to the power of 7 should give me...
package com.company;
public class Main {
public static void main(String[] args) {
double a = (1/84);
double b = Math.sqrt(123456879);
double c = Math.cbrt(2);
...
==============================================================
QUESTION:
(Find the number of days in a month) Write a program that prompts the user to enter the month and year and displays the...
Am doing the exercises in the first chapter of the book " JAVA PROGRAMMING - From the ground up"
In the short exercises, 7th exercise, the question is "If there are typically 120 different opcodes...