Heyyy, I'm back. Getting the hang of this java thing. Anyways, I have a few questions, I'll leave my hardest for last.
So, I believe I'm having an overloading method issue here. - public static boolean closeAccount (double acctBalance, int checksLeft) {
-
// returns true if acctBalance is less than zero or checksLeft is less than or equal to zero.
-
-
if (acctBalance < 0 || checksLeft <= 0){
-
return true;}
-
else{
-
return false;
-
}
-
}
-
-
}
-
*public static boolean closeAccount (int acctBalance, int checksLeft) {
-
// returns true if acctBalance is less than zero or checksLeft is less than or equal to zero.
-
-
if (acctBalance < 0 || checksLeft <= 0 ){
-
* return true;}
-
else{
-
* return false;
-
}
-
-
}
I'm getting a "class, interface, or enum expected" error on the lines with asterisks. I'm creating overloading methods, but I believe that as long as the arguments are different, then I'm okay. I have a double/int in the first (fine) and a int/int in the second. Little confused.
And lastly... how do you launch a browser? I've been searching, and there seems to be no basic answer to this. - import com.apple.mrj.MRJFileUtils;
-
import java.io.*;
-
-
public class Main {
-
-
String url = "http://www.google.com/";
-
-
public static void main(String[] args) {new
-
Open();
-
}
-
Open() {
-
try {
-
MRJFileUtils.openURL(url);
-
} catch (IOException ex) {}
-
}
-
-
-
}
Man... that's ugly. Anyways, but that's for a Mac. Instead, I'm trying to make a method to call instead of putting it under the main argument. Anywho, I'll keep working on that one. As always, any suggestion is greatly appreciated.
4 1566
Wait, found something. - URLDisplayer.getDefault().showURL(URL url);
Nevermind, fixed it. -
import java.io.*;
-
-
public class KyleTaylorToolBox {
-
-
public static void printEveryXtoY (int x, int y) {
-
// this method prints every xth integer from 0 to y that is less than or equal to y.
-
// example output when passed (4,14): 0 4 8 12
-
// example output when passed (2, 14): 0 2 4 6 8 10 12 14
-
int count = 0;
-
while (count <= y) {
-
System.out.println( + count);
-
count = count + x;
-
}
-
-
-
}
-
-
public static void launchBrowser ( ) throws IOException {
-
// this method starts a web browser like Internet Explorer. Search the Internet for help.
-
String url="http://www.cse.unt.edu";
-
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
-
-
-
}
-
-
public static boolean isOdd (int x) {
-
// this method returns true if x is odd and false if x is even.
-
if (x % 2 == 0){
-
return false;}
-
else{
-
return true;
-
}
-
}
-
-
//Create two overloaded methods called closeAccount:
-
-
public static boolean closeAccount (double acctBalance, int checksLeft) {
-
// returns true if acctBalance is less than zero or checksLeft is less than or equal to zero.
-
-
if (acctBalance < 0 || checksLeft <= 0){
-
return true;}
-
else{
-
return false;
-
}
-
}
-
-
public static boolean closeAccount (int acctBalance, int checksLeft) {
-
// returns true if acctBalance is less than zero or checksLeft is less than or equal to zero.
-
-
if (acctBalance < 0 || checksLeft <= 0 ){
-
return true;}
-
else{
-
return false;
-
}
-
-
}
-
}
-
-
Okay. Now I'm having problems calling the methods in a different class. Says "cannot find symbol".
You forgot to import KyleTaylorToolBox class in other class
@Steel546
I'm sure 'it' said a lot more, e.g. the symbol it couldn't find and where it couldn't find it (including the line number). That should give you some clues.
kind regards,
Jos
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Hmmm... |
last post by:
For the most part I understand the VB "Language". I also understand C,
C++, JAVA, JavaScript, etc, etc.
What always holds me back is that I don't know what to do with them. I
mean, I have good...
|
by: Chris |
last post by:
Here's the situation:
I work at a scientific institution and I have a portable electronic
device which is used to take measurements. The device produces a very
small amount of numerical data,...
|
by: GChong |
last post by:
Hi,
Im looking for some general 'marketing' info on dotnet: how long it
has been in use (i.e first release date), how many companies are using
it, number of .NET developers in the world,...
|
by: Alex |
last post by:
Hello
I am interested learn more about .NET but am uncertain of exactly what niche
it fills in the world of programming. (The more I read the more I am
confused).
What I am looking for is the...
|
by: ralamo |
last post by:
INSERT INTO ECN_1 (Old_SbPartNo, Old_PartDesc, Old_ManPartNo,
Old_Manuf, Old_Vendor, Old_RefDesi, Old_Qty,
New_SbPartNo, New_PartDesc, New_ManPartNo,New_Manuf, New_Vendor,
New_RefDesi, New_Qty)...
|
by: Alex |
last post by:
Hello
I am intersting in developing and my background is VBA used in Excel and a
brief intro to Java.
I am interested in learning beyond VB and feel that C++ would be a very good
language to...
|
by: Jolly Student |
last post by:
Dear Colleagues:
I am a systems guy who has been working with hardware, networking and basic
scripting for ten years or so. I have been given the opportunity to attend
..Net classes of all...
|
by: ben.a.yates |
last post by:
Hello, i have been an electronic engineer programmer for the last 15
years. In the early part of my career i was mainly a C programmer, but
in the last 10 years or so i've done little programming....
|
by: mia23 |
last post by:
Hello, I am a java beginner and I need series help in solving this program; my assignment is due after 2 days and I can't understand this program .
This is THE PROGRAM:
The ABC medical clinic...
|
by: Dexter |
last post by:
This Java based utility may be invoked from Java code to parse
mathematical expressions. It is useful for programmers developing
calculators, graphing utilities or other math related programs.
...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |