hi
i have this code
but i have problem that is
i can ensert the NO of job and saved it on txt file named by memory
but when i close the file memory all data on this file is lost , how can i saved it without lost data
and i wont to make the file memory on the 100 kb
and when enter the total of the job great than 100 kb the program must be send for me message " i canot saved more than 100 kb "
help me
this code i upload it on this sit http://www.2shared.com/file/2387324/...a/Fitting.html 21 1789
hi
i have this code
but i have problem that is
i can ensert the NO of job and saved it on txt file named by memory
but when i close the file memory all data on this file is lost , how can i saved it without lost data
and i wont to make the file memory on the 100 kb
and when enter the total of the job great than 100 kb the program must be send for me message " i canot saved more than 100 kb "
help me
this code i upload it on this sit
http://www.2shared.com/file/2387324/a059371a/Fitting.html
You want us to help you and yet you post your code elsewhere?
Come on don't be lazy. It's just a matter of copy and paste. And use code tags when you post the code.
hi
i have this code
but i have problem that is
i can ensert the NO of job and saved it on txt file named by memory
but when i close the file memory all data on this file is lost , how can i saved it without lost data
and i wont to make the file memory on the 100 kb
and when enter the total of the job great than 100 kb the program must be send for me message " i canot saved more than 100 kb "
help me -
-
import java.awt.*;
-
import javax.swing.*;
-
import java.io.*;
-
import java.io.FileNotFoundException;
-
import java.lang.SecurityException;
-
import java.util.*;
-
import java.util.Formatter;
-
import java.util.FormatterClosedException;
-
import java.util.NoSuchElementException;
-
import java.util.Scanner;
-
-
import java.io.InputStream;
-
import java.io.OutputStream;
-
import java.io.FileInputStream;
-
import java.io.FileOutputStream;
-
import java.io.FileReader;
-
import java.io.FileNotFoundException;
-
-
public class FittingAllgorithm
-
{
-
private Formatter output; // object used to output text to file
-
-
// enable user to open file
-
public void openFile()
-
{
-
try
-
{
-
output = new Formatter( "memory.txt" );
-
} // end try
-
catch ( SecurityException securityException )
-
{
-
System.err.println(
-
"You do not have write access to this file." );
-
System.exit( 1 );
-
} // end catch
-
catch ( FileNotFoundException filesNotFoundException )
-
{
-
System.err.println( "Error creating file." );
-
System.exit( 1 );
-
} // end catch
-
} // end method openFile
-
-
// add records to file
-
public void addRecords()
-
{
-
// object to be written to file
-
Job record = new Job();
-
-
Scanner input = new Scanner( System.in );
-
-
System.out.printf(
-
"%s\n%s\n%s\n%s\n%s\n","********************\n\nFitting Algorithem\n\n********************\n\nThis Create By\n",
-
"Khalid Ahmed Almallahy\n20032348\n\n********************\n",
-
"Supervesor by",
-
"\nMoamar Elyazgi.\n\n********************\n\n",
-
"Hint :- \n When You Wont to Exit Press <CTRL>+z\n\n========================================================\n\n" );
-
-
System.out.printf( "%s\n%s\n",
-
"Enter First Jop 'Process' number must be greater than 0\n Second Job 'Process'\n Third Job 'Process'\n last Job 'Process'",
-
"?" );
-
-
while ( input.hasNext() ) // loop until end-of-file indicator
-
{
-
try // output values to file
-
{
-
// retrieve data to be output
-
record.setAccount ( input.nextInt() );
-
record.setaccount1( input.nextInt() );
-
record.setaccount2( input.nextInt() );
-
record.setaccount3( input.nextInt() );
-
-
if ( record.getAccount() > 0 )
-
{
-
// write new record
-
output.format( "%d %d %d %d \n",
-
record.getAccount(),
-
record.getaccount1(),
-
record.getaccount2(),
-
record.getaccount3() );
-
} // end if
-
else
-
{
-
System.out.println(
-
"Job number must be greater than 0." );
-
} // end else
-
} // end try
-
catch ( FormatterClosedException formatterClosedException )
-
{
-
System.err.println( "Error writing to file." );
-
return;
-
} // end catch
-
catch ( NoSuchElementException elementException )
-
{
-
System.err.println( "Invalid input. Please try again." );
-
input.nextLine(); // discard input so user can try again
-
} // end catch
-
-
System.out.printf( "%s %s\n%s", "Enter account number greater than 0,",
-
"first Job, Second Job and Third Job and so on.", "?\n" );
-
} // end while
-
} // end method addRecords
-
// close file
-
public void closeFile()
-
{
-
if ( output != null )
-
output.close();
-
} // end method closeFile
-
-
-
//////////////////////////////////////////////////////////////////////////
-
-
-
int memory,dummycount;
-
int process;
-
int[] bestfit,worstfit,nextfit,firstfit;
-
-
public void place()
-
{
-
Job record = new Job();
-
-
Scanner inFile1= new Scanner(System.in);
-
Scanner iFile= new Scanner(System.in);
-
-
-
-
dummycount=0;
-
while (inFile1.hasNext())
-
{
-
memory = inFile1.nextInt();
-
dummycount=dummycount+1;
-
}
-
firstfit =new int [dummycount];
-
-
inFile1.close();
-
-
-
System.out.println("------For FirstFit algorithm---------");
-
-
inFile1= new Scanner(System.in);
-
-
dummycount=0;
-
while (iFile.hasNext())
-
{inFile1= new Scanner(System.in);
-
-
process = iFile.nextInt();
-
while (inFile1.hasNext())
-
{
-
-
memory = inFile1.nextInt();
-
if ((memory >=process)&&(dummycount< firstfit.length)&&(firstfit[dummycount]==0))
-
{
-
firstfit[dummycount]=process;
-
-
-
System.out.println("memory partition" +" "+ memory +" will accomodate process that need"+ " " +process);
-
}
-
}
-
-
-
dummycount++;
-
inFile1.close();
-
}
-
-
iFile.close();
-
-
-
-
System.out.println("------For BestFit algorithm---------");
-
-
-
nextfit =new int [dummycount];
-
-
-
-
-
System.out.println("------For NextFit algorithm---------");
-
dummycount=0;
-
System.out.println("Got this far");
-
iFile= new Scanner(System.in);
-
-
while (iFile.hasNext())
-
{
-
-
process = iFile.nextInt();
-
inFile1= new Scanner(System.in);
-
while (inFile1.hasNext())
-
{
-
-
memory = inFile1.nextInt();
-
if ((memory >=process)&&(dummycount< nextfit.length)&&(nextfit[dummycount]==0))
-
{
-
nextfit[dummycount]=process;
-
-
System.out.println("memory partition" +" "+ memory +" will accomodate process that need"+ " " +process);
-
}
-
}
-
-
-
dummycount++;
-
-
}
-
-
System.out.println("dummycount" +" "+dummycount);
-
inFile1.close();
-
iFile.close();
-
-
System.out.println("------For WorstFit algorithm---------");
-
-
return;
-
-
}
-
-
public static void main( String args[] ) throws FileNotFoundException
-
{
-
FittingAllgorithm application = new FittingAllgorithm();
-
-
application.openFile();
-
application.addRecords();
-
application.place();
-
application.closeFile();
-
} // end main
-
} // end class CreateTextFile
-
-
-
-
-
public class Job
-
{
-
private int account;
-
private int account1;
-
private int account2;
-
private int account3;
-
-
public Job()
-
{
-
// constructor
-
}
-
-
-
public Job( int acct, int account11, int account22, int account33 )
-
{
-
setAccount( acct );
-
setaccount1( account11 );
-
setaccount2( account22 );
-
setaccount3( account33 );
-
}
-
-
-
public void setAccount( int acct )
-
{
-
account = acct;
-
}
-
-
-
public int getAccount()
-
{
-
return account;
-
}
-
-
-
public void setaccount1( int account11 )
-
{
-
account1 = account11;
-
}
-
-
-
public int getaccount1()
-
{
-
return account1;
-
}
-
-
public void setaccount2( int account22 )
-
{
-
account2 = account22;
-
}
-
-
-
public int getaccount2()
-
{
-
return account2;
-
}
-
-
-
public void setaccount3( int account33 )
-
{
-
account3 = account33;
-
}
-
-
-
public int getaccount3()
-
{
-
return account3;
-
}
-
}
-
-
-
-
-
Read this article.
What do you mean by the total of the job greater than 100kb? Do you mean that the file size should not exceed 100kb?
Read this article.
What do you mean by the total of the job greater than 100kb? Do you mean that the file size should not exceed 100kb?
yes i wont to size of my file 100 kb
how can i do
or can u write code of this
ok
i see the article
but my code is true
but there are code that it saved any data on file
how write this code
yes i wont to size of my file 100 kb
how can i do
or can u write code of this
Use the File class. Open the API specs for it. It has a method for determining the size of a file. Just check your file's current size before adding data to it.
ok
but i dont have it is
can u write code
ok
but i dont have it is
...
What do you not have?
ok
..
can u write code
Some people think I can and some people think I can't ...
You'll have to write this yourself. We are here only to help you when you get stuck.
i canot have API specs
Of course you can. Here's a link to the specs for the File class.
Better still, you can download the whole thing from the link in this index.
Use the File class. Open the API specs for it. It has a method for determining the size of a file. Just check your file's current size before adding data to it.
i dont do it
????????????
i dont do it
????????????
You are no longer any sense. What do you mean by "i don't do it"?
mmmmmmmmmm
idont write the code
i need to saved data on my file how?????????
mmmmmmmmmm
idont write the code
i need to saved data on my file how?????????
So who writes the code? You want to save data to the file without writing the code?
P.S You only need to type each ? once.
So who writes the code? You want to save data to the file without writing the code?
P.S You only need to type each ? once.
i need code to saved the data
i need code to saved the data
help >>>>>>>>>>>>>>>>>>
any help place
oh
help meeeeeeeeee
any help place
oh
help meeeeeeeeee
Stop this. You are going nowhere with it.
We won't write the codes for you here. We'll just help you if you are stuck with the code. Now I've pointed you to the File class and an article that explains how to read and write to a file. What's your problem now?
kamsmartx, the next post you make will be the code that YOU wrote to attempt to solve your problem, or else I'm closing this thread.
TSDN members are expected to write their own code. We're happy to help you out if you have specific questions, but you can't realistically expect someone to do your coding for you on a free forum.
kamsmartx, the next post you make will be the code that YOU wrote to attempt to solve your problem, or else I'm closing this thread.
TSDN members are expected to write their own code. We're happy to help you out if you have specific questions, but you can't realistically expect someone to do your coding for you on a free forum.
I'm afraid this thread is leaning itself towards Jos' law ...
@OP: I'm afraid we have a language problem here: your command of the English
language is not enough to tell us exactly what your problem is. I'm nog trying to
offend you nor anybody else, but this is not going to work out.
Would it be possible if someone else (having a better grip on the English language)
asks your question on your behalf?
kind regards,
Jos
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Sugapablo |
last post by:
I have two ASP pages. They basically query a database, and spit out the
information as plain text in CSV format.
The first has the SQL query hardcoded into it. The second takes a SQL
query...
|
by: Jörg Braun |
last post by:
Hello NG,
i have a problem With WebRequest!
i want to download a htaccess saved file over a proxyconnetion with
authentication.
Download a file what is not saved with htaccess is no problem,...
|
by: harvie wang |
last post by:
In .Net,Through System.Configuration.ConfigurationSettings Get Application's
Settings
I can't find the Configuration Value from Register
Where the ConfigurationSettings saved?
How to Read it...
|
by: mchamsters |
last post by:
Just want to rant about something horrible that happened to me tonight.
It was my first time using the new Visual C#. I started a new project,
coding away continuously for about 6 hours. I saved...
|
by: charliewest |
last post by:
Hello -
I have images saved in my SQL SERVER 2000 database. Using ASP.NET (C#) is
there any way to temporarily save an image to a session object, and after
running some other operations, later...
|
by: Rich Wallace |
last post by:
Hello all,
Looking for suggestions and tips if possible.
I have an application running on a file server that utilizes the
FileSystemWatcher to trap when any Excel files are saved by a user. I...
|
by: Peter Proost |
last post by:
Hi group, I've got a question about the size of a saved bitmap.
What I need to do is open a bitmap if it needs resizing, resize and save it.
This isn't a problem, but the problem I have is that the...
|
by: Sharon |
last post by:
I have an XML question:
I'm have an XML node of type PointF and when it's saved to a file by
XmlDocument.Save(...) it saves as I expect it to be saved:
<ImageOrigin>{X=1.2,...
|
by: nanaalwi |
last post by:
Greetings,
Currently im doing an invoice software in which it will automatically save all the data entered by the user into excel file. Then when the user click 'SAVE' button, the excel file will...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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: 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: 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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
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...
| |