Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
bklyn_40
AplusHomeComputerServices (Sole Proprietor) Bachelor's Database Administration Associates in Information Technologies. President's Honor Roll (4.0 GPA). Certifications: CompTIA A+ & Net+, Microsoft's MCP, XP Professional. Forensics Security Certification. Experiences: APlusComputerServices@ymail.com Computer Technician (10+ years) Electronic Tech (12yrs Navy) Avionic Technician (5yrs) Supermarket Manager-3 years Restaurant Manager- 4 yrs. Real Estate License Life Ins License.
Excel 2010: I need to reverse the value of a Column. Example - in cell G3 I have =sum(G1-G2) which will always be negative.?
Then in cell A12 I have = G3 BUT I need to have that negative value always automatically be reversed to a positive value. Is that possible?
6 AnswersSoftware5 years agoJAVA: ONE error with amountList.length;?
I have ONE error I cannot figure out.
The line of code is "for (int i=0; i < amountList.length; i++)" and the error says "Length cannot be resolved, or is not a field"
The entire code is below. PLEASE let me know WHY I have this error and what should be written.
package index;
import java.util.*;
import java.text.DecimalFormat;
import java.util.ArrayList;
public class threeArrayLists
{
//declared arrays
private ArrayList<Double> priceList = null;
private ArrayList<Double> quantityList = null;
private ArrayList<Double> amountList = null;
//here are the final arrays with content
final double[] Price_ARRAY = { 10, 14, 13, 16, 18, 9, 6, 18, 12, 3};
final double[] Quantity_ARRAY = {4.1, 8.15, 6.2, 7.35, 9.3, 15.3, 3.5, 5.4,
2.9, 4.8};
public threeArrayLists()
{
//this calls the extend method
extend(Price_ARRAY, Quantity_ARRAY);
}
public void extend(double[] priceArray, double[] quantityArray)
{
//objects initialized
priceList = new ArrayList<Double>();
quantityList = new ArrayList<Double>();
amountList = new ArrayList<Double>();
// product of the quantity by price, into the subsequent elements in amount array
for (int i = 0; i < priceArray.length; i++) //here is error LENGTH
{
priceList.add(priceArray[i]);
quantityList.add(quantityArray[i]);
amountList.add(priceArray[i]*quantityArray[i]);
}//end of statement
display();
}
3 AnswersProgramming & Design8 years agoJAVA create 3 arrays declared in main()?
I wrote a program declaring three ArrayLists (priceList, quantityList, amountList). Each to be declared in main() and to hold a minimum of 10 double-precision numbers. The following is the code but it fails miserably. Any help to show me where & why it isn't working is greatly appreciated.
package threeArrayLists;
import java.text.DecimalFormat;
import java.util.ArrayList;
public class ThreeArrayLists
{
//declare the three arrays
private ArrayList(Double) pricelist = null;
private ArrayList(Double) quantityList = null;
private ArrayList(Double) amountList = null;
//final arrays
final double[] PRICE_ARRAY = { 10.62, 14.89, 13.21, 16.55, 18.62, 9.47, 6.58, 18.32, 12.15, 3.98};
final double[] QUANTITY_ARRAY = {4.0, 8.5, 6.0, 7.35, 9.0, 15.3, 3.0, 5.4, 2.9, 4.8};
public ThreeArrayLists()
{
//this calls the extend method
extend(PRICE_ARRAY, QUANTITY_ARRAY);
}
public void extend(double[] priceArray, double[] quantityArray)
{
//this is where the arraylist objects are initialized
pricelist = new ArrayList(Double)();
quantityList = new ArrayList(Double)();
amountList = new ArrayList(Double)();
/*puts the product of the quantity by price into the corresponding elements in the amount array*/
for (int i = 0; i ( priceArray.length; i++)
{
pricelist.add(priceArray[i]);
quantityList.add(quantityArray[i]);
amountList.add(priceArray[i]*quantityArray[i]);
}//end of statement
display();
}//end of extend method
//displays the results of all three lists in a decimal format
public void display()
{
DecimalFormat df = new DecimalFormat("###.0#");
for (int i=0; i (amountList.size(); i++)
{
System.out.println((i+1) + ")"
+ df.format(pricelist.get(i))
+ "*" + df.format(quantityList.get(i))
+ "=" + df.format(amountList.get(i)));
}//end for statement
}//end display method
public static void main(String[] args)
{
new ThreeArrayLists();
}
}//end
1 AnswerProgramming & Design8 years agoJava - Error message doesn't display?
This program has user input a series of 10 single-digit numbers and determines the largest one. Except main() method, no other user-defined method is required.
If user enters a double-digit number, the counter should not advance and an error should display.
The counter works fine, but I cannot get the error message to display.
Any help would be greatly appreciated.
___________________________________________________________________
package largest;
import javax.swing.JOptionPane;
public class largest {
// the main method
public static void main(String[] args)
{
//initializing the variables
int largest = 0;
int counter = 1;
int number = 0;
//Counting while
while ( counter <= 10)
{
number = Integer.parseInt(JOptionPane.showInputDialog("Enter any single digit number: " + counter + " "));
if (number >= 0 && number <= 9)
{
counter++;
if (number > largest)
largest = number;
// This does not display as it should and is the only error in the code.
if (number >9 )
JOptionPane.showMessageDialog(null, "Value entered is not a single digit" , null, JOptionPane.ERROR_MESSAGE);
}
} // This displays correctly
JOptionPane.showMessageDialog(null, "The largest number is " + largest);
}
}
2 AnswersProgramming & Design8 years agoJava JOptionPane Error?
JOptionPane Error.
I tried two different ways to display the output. I wrote it EXACTLY as the book shows, but get an error no matter which one I use.
When I use the following:
final JOptionPane(frame, "The diameter is ", diameter,
+ "\n\tThe circumference is ", circum,
+ "\n\tThe area is ", area,JOptionPane);
I get the following error:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Syntax error, insert "enum Identifier" to complete EnumHeaderName
Syntax error, insert "EnumBody" to complete BlockStatement
The member enum $missing$ cannot be local.
When I use JOptionPane.showMessageDialog(null, "The diameter is ", diameter,
"\n\tThe circumference is ", circum,
"\n\tThe area is ", area, JOptionPane.PLAIN_MESSAGE);
The error I get is:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method showMessageDialog(Component, Object, String, int, Icon) in the
type JOptionPane is not applicable for the arguments (null, String, double,
String, double, String, double, int).
Please show me how either one should be written error free.
Here is the entire code:
package Circle;
/*******************************************************************************
* Program Name: Circle.java
* Program Description:
diameter = 2 * radius
circumference = 2 * Math.PI * radius
area = Math.PI * radius * radius
******************************************************************************/
import javax.swing.JOptionPane;
import java.util.Scanner;
public class circle {
public static void main( String[] args ) {
// Declared Variables
double radius, circum, area, diameter;
String num1;
Scanner input = new Scanner( System.in );
num1= JOptionPane.showInputDialog(null,"Enter the radius of a circle: "); // user prompt
radius = Integer.parseInt(num1);
// Math.PI example System.out.println("Pi is " + Math.PI);
diameter = 2 * radius;
circum = Math.PI * 2 * radius;
area = radius * radius * Math.PI;
/* final JOptionPane(frame, "The diameter is ", diameter,
+ "\n\tThe circumference is ", circum,
+ "\n\tThe area is ", area,JOptionPane);
This gives an error stating
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Syntax error, insert "enum Identifier" to complete EnumHeaderName
Syntax error, insert "EnumBody" to complete BlockStatement
The member enum $missing$ cannot be local
at Circle.circle.main(circle.java:31)
*/
JOptionPane.showMessageDialog(null, "The diameter is ", diameter,
"\n\tThe circumference is ", circum,
"\n\tThe area is ", area, JOptionPane.PLAIN_MESSAGE);
/* This code gives me the following error.
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method showMessageDialog(Component, Object, String, int, Icon) in the
type JOptionPane is not applicable for the arguments (null, String, double,
String, double, String, double, int)at Circle.circle.main(circle.java:44)
*/
} // end method main
} //end class circlePi
1 AnswerProgramming & Design8 years agoJava - Adding more methods to a working program?
The following is a working palindrome prg in JAVA. It asks the user for an input and it checks if it’s a palindrome, giving the proper response. But now I need to modify it to include three more methods, besides the main(). Nothing else is to change.
The three new methods to add are:
1 - retrieveInput() method, which prompts and retrieves the input values;
2 - check() method, which determines whether it is a palindrome; and
3 - display() method, which displays the result.
import java.util.*;
class Palindrome
{
public static void main(String args[])
{
String original, reverse="";
Scanner in = new Scanner(System.in);
System.out.println("Enter a string to check if it is a palindrome");
original = in.nextLine();
int length = original.length();
for ( int i = length - 1 ; i >= 0 ; i-- )
reverse = reverse + original.charAt(i);
if (original.equals(reverse))
System.out.println("Entered string is a palindrome.");
else
System.out.println("Entered string is not a palindrome.");
}
}
1 AnswerProgramming & Design8 years agoJava - calculting the volume for a pool?
I got a java prg to calculate the volume & surface area of a sphere, but can't get one to work for calculating volume for a pool (square, rectangle, round, oval) to work. Formulas work, but not the program. Here's the one for Volume/Surface of sphere, but I'm lost concerning the pool. Maybe just been doing too much too long.
import java.util.Scanner;
public class Sphere
{
public static void main(String argv[])
{
Scanner input = new Scanner( System.in );
System.out.print( "Enter radius of sphere: " );
float radius = input.nextFloat();
System.out.println("Sphere volume is : " + ( 4.0 / 3.0 ) * Math.PI * Math.pow( radius, 3 ));
System.out.println("Sphere Surface Area is : " + 4.0 * Math.PI * Math.pow( radius, 3 ));
}
}
After length, width, & depth are entered, user can click Calculate Volume and the program will display the calculated volume (length * width * depth in cubic feet).
Incomplete forms: Exception handling is used here to catch exceptions, including incomplete forms, invalid entries, and combinations of these.
Invalid input:
Combination invalid input/incomplete input:
Round Pool - When Round is selected, the width field is automatically filled in with the same value entered by the user in the length field since it's a circle. After entering a length and depth, the Calculate Volume button will display the volume (Pi * ((length/2)^2) * depth). The user must be informed that the width was automatically set to the same value as the length.
Oval Pool - When Oval is selected, the width field is opened up.
The formula used to calculate the volume is (Pi * (length * width)^2) * depth.
1 AnswerProgramming & Design8 years agoMySQL proper Ssyntax?
Tables and colums are
Customer (Fname, Lname, CustID),
BookOrd, (CustID, OrderID),
OrderItem(BookId, OrderID),
Books (BookID).
I need a query to get the total of copies ordered for all customers who placed an order for the most expensive book. I am unsure of the syntax.
I know I need to use the SUM and MAX options but am clueless how to do it in the correct order.
1 AnswerProgramming & Design8 years agoformula to calculate combinations?
How do you set up this word problem:
Distribution Center A wishes to send its products to five different retail stores: B, C, D, E, and F. How many different route plans can be constructed so that one truck, starting from A, will deliver to each store exactly once, and then return to the center?
4 AnswersMathematics1 decade agoHow do you feel about?
IN CA, Filipino Workers sue over English-only rule.
How do you feel about only English being spoken at work?
How do you feel about people living in the U.S. who don't/won't speak any English?
1 AnswerLanguages1 decade agoMath - Least Common Denominator?
I have multiple problems like the following (5x/3) – (4+x/2) = (x-2/4) + 1.
I realize that I must use the distributive property, then simplify, finally subtract (or add) some number to find what X equals to satisfy this problem. I know I am doing something wrong because I first get 4(5x) – 6(4+x) = 3(x-2)+ 6(1) & this gives me the very wrong answer of 26x-24 = 3x
3 AnswersHomework Help1 decade agoMath - Multiplying by the least common denominator?
I have multiple problems like the following (5x/3) – (4+x/2) = (x-2/4) + 1.
I realize that I must use the distributive property, then simplify, finally subtract (or add) some number to find what X equals to satisfy this problem. I know I am doing something wrong because I first get 4(5x) – 6(4+x) = 3(x-2)+ 6(1) & this gives me the very wrong answer of 26x-24 = 3x
2 AnswersMathematics1 decade agoWhat are common elements (not functions) of god myths?
I know what the functions are (explain natural phenomena, bind a clan, tribe or nation together, record historical events, give a verbal geography lesson, set examples for behavior, control people...)
But can you clarify what are common 'elements'?
2 AnswersMythology & Folklore1 decade agoWord:CTRL+CLICK not working to follow hyperlink?
Whenever I try to follow a hyperlink I get an error "The operation has been canceled due to restrictions in effect on this computer"
I have it "enabled" in Word Options-Advanced-Editing Options.
1 AnswerSoftware1 decade agoJAVA Create a PRINT Method?
Here's my program. Can anyone tell me what is wrong & how to correct it?
import java.io.*; // This imports the File class
import java.text.*;// enables DecimalFormat to be used with 'Payment'
public class Lab09a
{
public static void main(String[] args) throws Exception
{
double Principle; // Principle amount
double Time; // Amount of time in years
double Interest; // the interest rate FOR this program it will NOT vary from 7%
double MP; // This equals the output of the calculations which will be the monthly payment
FileWriter fw = new FileWriter("mortgageTable.txt");
BufferedWriter bw = new BufferedWriter(fw);
PrintWriter pw = new PrintWriter(bw);
DecimalFormat Payment = new DecimalFormat("$,###.00"); // Creates format for Payment
mortgageTable(); // Is this where I should be calling this method??
// Below is what I am trying to create as a method (see below). As part of the program it works fine.
pw.println(" Mike's Bank");
pw.println(" ");
pw.println(" Mike is President");
pw.println(" ");
pw.println(" ");
pw.println(" Principle " + " Interest "+"Time(yrs)" + " Payment");//This places the SubHeadings
/*
These are the error I get
Lab09a.java:81: illegal start of expression
public static void mortgageTable()
^
Lab09a.java:93: class, interface, or enum expected
}
^
Lab09a.java:102: class, interface, or enum expected
}→
^
3 errors
or I get
Lab09a.java:111: illegal start of expression
public static void mortgageTable()
^
1 error
Depending on placement.I am following the directions in my text, but apparently I am not
reading what it says or I am not seeing what is a vital missing part.
*/
for(Time = 15; Time <= 30; Time += 15)
{pw.println(" ");
for(Principle = 50000; Principle <= 100000; Principle += 10000)
{
Interest = .07;
MP = Principle * (Interest / 12) / (1 - (1 / Math.pow((1+ (Interest / 12)),(Time * 12))));
pw.println(" $" + Principle + " " + Interest + "% " + Time + " " + " " + Payment.format(MP));
}
}
pw.close();
/*
This is the method I am trying to create so I can call it from any program.
public static void mortgageTable()
{
pw.println(" Mike's Bank");
pw.println(" ");
pw.println(" Mike is President");
pw.println(" ");
pw.println(" ");
pw.println(" Principle " + " Interest "+"Time(yrs)" + " Payment");//This places the SubHeadings
}
}
5 AnswersProgramming & Design1 decade agoLOOP in JAVA?
Help! My brain is fried. I know that I know this, I just can't "see" clearly to get ir done. This works fine except for AFTER the message "You entered an incorrect lenght of time. Would you like to try again?");
I cannot get the right syntax for when you make a selction, to go back & re-enter rather than go forward to the next line.
import javax.swing.JOptionPane;
import java.text.*;
public class mortgage
{
public static void main(String[] args)
{JOptionPane.showMessageDialog(null, "This script will calculate your monthly mortgage payment at 15 or 30 years");
int again; //This is the variable that will store the users YES or NO input at the end.
DecimalFormat Payment = new DecimalFormat("$,###.00");
do
{String PrincipleString = JOptionPane.showInputDialog(null, "Enter the principle");
String InterestString = JOptionPane.showInputDialog(null, "Enter the Interest Rate as 0.xxx");
String TimeString = JOptionPane.showInputDialog(null, "Enter the lenght of time");
Double Principle = Double.valueOf(PrincipleString);
Double Interest = Double.valueOf(InterestString);
Double Time = Double.valueOf(TimeString);
if (Time==30)
{Double MP = Principle * (Interest / 12) / (1 - (1 / Math.pow((1+ (Interest / 12)),(Time * 12))));
JOptionPane.showMessageDialog (null, "If your PRINCIPLE is $100,000 at 7% for 30 years, your monthly payment will be " +(Payment.format(MP)));}
else
if (Time==15)
{Double MP = Principle * (Interest / 12) / (1 - (1 / Math.pow((1+ (Interest / 12)),(Time * 12))));
JOptionPane.showMessageDialog (null, "If your PRINCIPLE is $100,000 at 7% for 15 years, your monthly payment will be " +(Payment.format(MP)));}
else
JOptionPane.showConfirmDialog (null, "You entered an incorrect lenght of time. Would you like to try again!");
//WHAT DO I PUT HERE so you can re-enter info rather than being asked the next question?
again = JOptionPane.showConfirmDialog(null,"Would you like to try again different variables?");
}
while(again == JOptionPane.YES_OPTION);
System.exit(0);
}
}
3 AnswersProgramming & Design1 decade agoUsing WHILE in a JAVA program?
My prgrm using the 'IF' command works. Now the book wants to use the WHILE cmd. I can't get correct syntax. Any help/guidance is greatly appreciated.
import javax.swing.*;
import java.text.*;// enables DecimalFormat.
public class Electric61
{
public static void main (String args[])
{double newUsage, amtDue, over1, over2;
int again;
String oldMtrStr, newUsageStr, cnameStr, newMtrStr;
do
{ cnameStr = JOptionPane.showInputDialog(null, "Enter Customer Name");
String oldMtrString = JOptionPane.showInputDialog(null, "Enter Old Meter Reading");
String newMtrString = JOptionPane.showInputDialog(null, "Enter New Meter Reading");
String acctString = JOptionPane.showInputDialog(null, "Enter Account Number");
Double oldMtr = Double.valueOf(oldMtrString);
Double newMtr = Double.valueOf(newMtrString);
Double acct = Double.valueOf(acctString);
newUsage = (newMtr - oldMtr);
DecimalFormat Due = new DecimalFormat("$,###.00");
// Here needs to be changed from IF/Else to WHILE/FOR
if(newUsage < 301)
{amtDue=5.00;}
else
if(newUsage < 1001)
{over1 = newUsage - 300;
amtDue=(over1 * .03) + 5.00;}
else
{over2 = newUsage - 1000;
amtDue = (over2 * 0.02) + 35.00;}
JOptionPane.showMessageDialog(null,"Company Name (if applicable)" +
"\nYour Account number is " + acctString +
"\nCustomer Name is " + cnameStr +
"\nNew Meter Reading is " + newMtrString +
"\nOld Meter Reading was" + oldMtrString +
"\nKwh Used is: " + newUsage +
"\nThe TOTAL Amount Due is " + Due.format(amtDue));
again = JOptionPane.showConfirmDialog(null,"Another Customer to Enter? ");
}
while(again == JOptionPane.YES_OPTION);
System.exit(0);
}
}
2 AnswersProgramming & Design1 decade ago