Program Should Copy Person With Highest Percent From File

Mar 23, 2014

The program should copy person with the highest percent from the file 'plik1', and then put it to the file 'plik2'.The problem occurs while compiling.

Java Code: string cannot be resolved to a type
string cannot be resolved to a type
string cannot be resolved to a type
string cannot be resolved to a type
string cannot be resolved to a type
string cannot be resolved to a type
string cannot be resolved to a type
string cannot be resolved to a type mh_sh_highlight_all('java'); Code:

[code]....

View Replies


ADVERTISEMENT

Writing A Program To Test Person Class

Nov 4, 2014

User-defined classes. The concept of getters and setters goes right over my head. Right now we're to write a program to test the Person class below. We have to create 2 instances of the class to test each constructor, and test each method.

class Person {
// Data Members
private String name; // The name of this person
private int age; // The age of this person
private char gender; // The gender of this person
// Default constructor
public Person() {
this("Not Given", 0, 'U');

[code]....

then my output will print out the name. But the assignment doesn't tell us to modify the Person class at all, just to create a tester one.

View Replies View Related

Program That Verify The Correctness Of Person Birth Date

Mar 9, 2015

How to write a program that will verify the correctness of a person`s birth date in java. The birth date is to be typed in by the user. the program should verify the following: Birth date entered should be of type java.util.Date(), Birth date may not be in future, Age may not exceed 110 years.

View Replies View Related

GUI Application - Read Some Person Details From A File And Then Put The Result In JList

Aug 31, 2014

I'm new to programming and java and I'm trying to understand how exactly this piece of code works and what exactly does. I'm trying to make my first GUI application and to read some person details from a file and then put the result in a Jlist.

private static final String SEPARATOR = ",";
public static ArrayList<Speaker> getAllMembers() {
ArrayList<Member> members = new ArrayList<Member>();
try {
File file = new File(Resources.MEMBERS_TXT);
Scanner fileReader = new Scanner(file, "utf-8");
String[] properties;

[Code] ....

View Replies View Related

Reading From File And Sort Data Based On Person GPA - Catching Error

Dec 9, 2014

I am catching an error in my driver class that reads from a file and sorts the data based on a person's GPA. Here is my code:

import java.io.*;
import java.util.*;
public class Driver {
public static void main(String[] args) {
new Driver(args[0]);

[Code] ....

Why throwing this exception?

View Replies View Related

How To Make A Program That Determines The Highest Value Out Of Inputted Numbers

Sep 14, 2014

how to make a program that determines the highest value out of the inputted numbers.

View Replies View Related

Read Information From File - How To Get Highest Value

Nov 12, 2014

The requirement asked me to write a Java program to read information from the file, display the original information along with the player's average score of the season (one line for each player), and announce who is the highest average-scoring player of the team. But I always only get the highest which show the last player.

Such like the output showed:

Smith 13.0 19.0 8.0 12.0 Player's average: 13.00
Badgley 5.0 Player's average: 5.00
Burch 15.0 18.0 16.0 Player's average: 16.33
Watson Player's average: 16.33
Knox 10.0 12.0 8.0 6.0 Player's average: 9.00
Casler 15.0 7.0 Player's average: 11.00
Winorburg 13.0 14.0 14.0 23.0 20.0 Player's average: 16.80
Morton 4.0 11.0 13.0 Player's average: 9.33
Seeling 16.0 8.0 9.0 11.0 Player's average: 11.00
Tanshi 5.0 13.0 10.0 Player's average: 9.33

The highest average-scoring player is: Tanshi

import java.util.Scanner;
import java.io.*;
public class PA7{
public static void main(String[] args) throws IOException{
String name = null;

[Code] .......

View Replies View Related

Java Program - Find Next Highest Or Lowest Prime Number

May 2, 2014

Java program takes positive int from user and determine if prime. Next the program finds next highest or next lowest prime number.

import java.io.*;
import java.util.*;
public class pa2take2 {
public static void main (String[]args){
int menus; //menu selection

[Code] ......

View Replies View Related

Search For Highest Number In File / Print Its Title And Value

Dec 9, 2014

In a text file, I have individual titles (starting with ">" character), and under those titles, I have calculated values for a Counter. I want to search the entire text file for the highest counter under every title. After I get the highest counter, I would like to print it's title, name of the counter, and counter value. Example of the code I already have:

int letterCounter;
String line;
if (line.startsWith (">")) {
bw.write ("");
bw.write (line);
} else {
//code that counts how many total letters (letterCounter) under title
}

I am just trying to use basic concepts.

Sample of my text file:

>gi 91206428 ref NP_001035160.1 seven transmembrane helix receptor precursor [Homo sapiens]
letterCounter is 43
>gi 157412240 ref NP_001094800.1 C1GALT1-specific chaperone 1-like [Homo sapiens]
letterCounter is 7
>gi 117938299 ref NP_001071105.1 RAB6C-like [Homo sapiens]
letterCounter is 109

Sample of desired output:

>gi 117938299 ref NP_001071105.1 RAB6C-like [Homo sapiens]
letterCounter is 109

View Replies View Related

Write A JAVA Program That Will Input 10 Scores And Output Highest And Lowest Score

Jan 9, 2015

1.Write a JAVA program that will input 10 scores and output the Highest and Lowest score.

2.Write a JAVA program that will input the base and power and display the result: Example: Base is 4 Power is 2 the answer is 16 (Note: Math.pow( ) method is not allowed)

3.Write a JAVA program that will input an integer number, and then will output the sum of all inputted numbers. The program will stop in accepting inputs if the user entered 0.

View Replies View Related

Copy A Exe File From One Location To Another?

Aug 1, 2014

I'm trying to copy a exe file from one location to another. It seems simple, but I have failed to find anything about it besides coping the contents in txt files, but that does nothing for executable.

View Replies View Related

Copy File With Name And Timestamp?

Jun 8, 2014

I read and then copy files into a subfolder, and I need to rename the file names by adding the timestamp to the file name, for example like: "filename1_25.06.14_15:00:00.txt". How can I do that? Here is what I have:

public class Table_data {
static String files = null;
static List<O> l= new ArrayList<O>();

[Code]....

is it right what i tryed, because i get nothing with timestamp in file after running this.

View Replies View Related

How To Keep Track Of Percent Full

May 20, 2014

I'm trying to make a canteen class that holds water. It holds two quarts of water and two quarts is 100%.

public double maxVolume;
public int percentFull;

Right now the Canteen is empty.

public void Canteen()
{
percentFull=0;
maxVolume=0;
}

And right now I'm trying to make a constructor that specifies the amount of liquid the canteen can hold and specifies the percent full.

public Canteen(double maxVolume, int percentFull)
{
}

Should I make this second Canteen an integer, a double, or something else? Also, how do I make sure the Canteen never reaches higher than 100%. I'm also curious how I can keep maxVolume and percentFull connected so the % of water is consistent with the number of quarts(2) the Canteen can hold.

View Replies View Related

Calculate Percent In Java

Jan 3, 2014

I would like to change the precent from *1.17 (17%) to calc of precent like this :

3% + 5% + 5$

For example :

The resault is 10$ - i want to get :

10$ +3%(0.3$) + 0.5% (0.51$) + 5$ = 15.81$

How i change this line to this calc

if(results[i].getSite()=='Xxx'&&XPrice==0)
{
XPrice =(results[i].getPrice() *1.17);
}
}

View Replies View Related

Copy File From C To Another Drive And Avoid Duplication?

Jan 12, 2014

Write a program to copy file from c: drive to another drive and avoid duplication??????????

View Replies View Related

Sending To All Vs Sending To One Person In Server / Client Program

Apr 17, 2014

I have two programs that I'll post below, one is a Server and the other is a Client. The ChatServer runs once and many clients can run ChatClient from separate computers and talk together in their GUI's. The the client program comes with two buttons, one that's simulates the sending of a message to a single user ; "Send Message To User", and one that just generally sends a message ; "Send Message To All". Although now the Clients on the server seem to be able to selectively send messages to an individual by giving the recipient name, all the clients can see that message, which is not exact what I am aiming for. What I am going for is having the "Send Message To User" button click to send a message to the named user without all other users seeing the message.

The Server Program Code

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;

[Code] ....

Now I have tried thing like having various input output streams and trying to connect those, but no luck. Tried fiddling with having the names arraylist directing the messages to one client versus all but that did not work out either. How I what I would need to do to go about doing this?

View Replies View Related

How To Create Folder And Copy Documents From JAR File Into Folder With Code

Sep 8, 2014

Where can I learn or how can I, being the most efficient way known to do so, create a folder outside my JAR file with the java source code, this then will copy YAML documents from my JAR file to that folder, then I need to read the YAML documents some way. I'm making an addon for a game, I am using an API that allows you to make a config.yml easily, and add and read entries from it, but I've read that I need to make my own methods to be able to create additional YAML documents.

I don't exactly know what to type in google to perhaps find such a page, but I did try to find a tutorial page about this or something and couldn't.

I've partially figured out how to create a folder, but I have a problem, how can I RETURN one directory to make the folder, I don't want to make the folder in the JAR file I want to make it just outside the Jar file in the same folder that the Jar file is at.

View Replies View Related

How To Sort TreeSet By Age Of Person

Aug 2, 2014

public class Person implements Comparable<Person> {
// the age of the person
private int age;
//the name of the person
private String name;
//the Integer object to wrap the age value;
private Integer ageWrap;

[Code] .....

The collection library has a class named TreeSet, which is an example of a sorted set. Elements in this set are kept in order. Carefully read the description of this class, and then write a class Person that can be inserted into a TreeSet, which will then sort the Person objects by age.

This is the exercise I am trying to solve. And this is as far as I have gotten to. Is it possible to sort my setOfPersons TreeSet directly? I tried to use

Collections.sort(setOfPersons)

method but it wont compile, and I realized that it is not applicable to TreeSet. So I made the

sortByAge()

method to do it indirectly...

I am puzzled though because in the exercise it states

write a class Person that can be inserted into a TreeSet, which will then sort the Person objects by age.

meaning that the TreeSet will sort the Person Objects and not my class..

View Replies View Related

Next Birthday Of Person - Days Remaining Total Way Off?

Oct 2, 2014

I'm supposed to calculate and display the number of total days, and then the number of months, and days from now (when the program is run) to when the person's next birthday is (no leap year). Here is my code:

import java.util.Scanner;
import java.text.*;
import java.lang.System;
import java.util.Date;
import java.util.Calendar;
public class CSCD210Lab3 {
public static void main (String [] args)

[Code] .....

When I call daysFromMillis in the print statement, if I enter in a birthday of 02/17/1993, I will get an answer of "our birthday is 5435 days from now."

View Replies View Related

Calculate And Display Person Body Mass Index

Feb 12, 2015

I have to write a program that calculates and displays a person's body mass index (BMI). The BMI is often used to determine whether a person with sedentary lifestyle is overweight or underweight for his or her height. A person's BMI is calaculated with the following formula:

BMI = Weight X 703/Height^2

where weight is measured in pounds and height is measured in inches. The program should display a message indicating whether the person has optimal weight, is underweight, or is overweight. A sedentary person's weight is considered optimal if his or her BMI is between 18.5 and 25. If the BMI is less than 18.5, the person is considered underweight. If the BMI value is greater than 25, the person is considered overweight.However I can't seem to get rid of these errors:

----jGRASP exec: javac BMI.java
BMI.java:28: error: cannot find symbol
Scanner keyboard = new Scanner(System.in);
^
symbol: class Scanner
location: class BMI
BMI.java:28: error: cannot find symbol

[code]....

View Replies View Related

Java Class Person - Adding Data To Text

May 5, 2014

Your Tester class main method must use an array or an ArrayList of Person objects. It must be populated from a text data file, friends_data.txt. Add the following data to your text file,

Michelle, 12/20/2008, Camilla
Bryan, 3/8/2007, Tom
Camilla, 6/7/2005, Michelle
Tom, 10/15/2007, Bryan
Charlotte, 3/2/2008, Michelle

Each line has the meaning:

-Person name, Person date of birth (MM/DD/YYYY), name of best friend
-Write a Java program that reads in the data from the friends_data.txt file, allocates a new
-Person for each and then stores the newly created object in either an Array or an ArrayList.
-Next print out a report showing the following information for each Person,

1. The Person's name
2. Their popularity counter
3. Their age on May 1, 2014
4. The name of their best friend
5. The age of their best friend on May 1, 2014

Finally, print the name of the most popular Person and the name of the oldest Person.

Person Class

import java.util.ArrayList;
public class Person {
public String personsName;
public String personsFriend;
public String personsBirthday;
public int personsPopularity;
public int popularity = 0;

[code]...

I keep getting this error from the compiler:

System.out.println("Popularity : " + personsOfInterest[i].getPopularityNumber());

"method getPopularityNumber in class Person cannot be applied to given type:
Required: java.lang.String[]; found: no arguments; reason: actual and formal argument lists differ in length.

View Replies View Related

Calculate Person Calories Burned Per Minute - Possible Loss Of Precision Error

Feb 2, 2015

I was asked to write code to calculate a person's calories burned/min. This is what I got. The problem is I keep getting an error.

--------------------Configuration: <Default>--------------------
C:Program FilesJavajdk1.7.0_72CaloriesBurned.java:22: error: possible loss of precision
caloriesBurnedPerMinute = 0.0175 * METS * weightInKg;
^
required: int
found: double
1 error

Loss of precision? What does that mean? Do I have to change weightInKg into some other number type?

import java.util.Scanner;
public class CaloriesBurned
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
int runningHours, basketballHours, sleepingHours, METS, caloriesBurnedPerMinute;

[Code] ....

View Replies View Related

Web Services :: Telephone Book - Enter Phone Number / Correct Person With Name And Address Should Appear

Nov 30, 2014

Applications: Netbeans (8.0.1), Apache Tomcat

My Aim: Creation of a telephone book

How should it work:

I have a Database with Data of people (name, adress, phone number).

If a user enters a phone number (CLIENT) -> the correct person with the name and adress should appear.

I build up the infrastructure and now I'm at the point that I have to create a Webmethod for it. I just worked on projects like addition of two integers, hello "name", ... I think this example now is harder, BUT i can learn a lot!

View Replies View Related

Highest Of Three Grades

Sep 14, 2014

So I have created this program but I am having a couple of small problems with it. The first problem is that the user inputted numbers should all be on the same line. I have spent hours trying to figure this out and I have looked online but I've had no luck. The second problem is that the "lowest score" should be 42 and not 42.0. I don't understand how to make it so the number is an integer. I have posted the output that i'm getting and the way the output should look like at the bottom.

import java.util.Scanner;
public class Random
{
public static void main(String [ ] args) {
Scanner input = new Scanner(System.in);
double a, b, c;

[Code] .....

This is the output that i'm getting.

Enter three scores: 87
42
94

The average is: 74.33333333333333
The lowest score was: 42.0
The average without the lowest score is: 90.5
The grade is: A

This is the way the output should look like.

Enter three scores: 87 42 94

The average is: 74.33333333333333
The lowest score was: 42
The average without the lowest score is: 90.5
The grade is: A

View Replies View Related

How To Get Highest Value Of Array Of Integers

Jul 1, 2014

I am trying to write a method that returns the busiest hour in a logAnalyzer class that read web server data and analyze hourly access patterns and stores them in an array. My problem is, in order to get the busiest hour, I need to go through the hourCounts array to find the element with the biggest count.

View Replies View Related

Sorting From Lowest To Highest

Feb 23, 2014

I'm very new to Java and ran into a problem. My results are not in order and I'm not sure what I'm doing wrong.

My results come out like this instead of being in order from lowest to highest: "77 99 44 55 22 88 11 0 66 33"

Here's what I have:

class ArrayIns {
private long[] a; // ref to array a
private int nElems; // number of data items
//--------------------------------------------------------------
public ArrayIns(int max) // constructor
{
a = new long[max]; // create the array
nElems = 0; // no items yet

[Code] .....

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved