|
I need help with 3 java programming assignments how do I get help with them?
Optional Information:
OS: Mac OS X; Browser: Firefox
Already Tried:
Code # 1
Write the program in Java (with a graphical user interface) and have it calculate and display the mortgage payment amount from user input of the amount of the mortgage and the user's selection from a menu of available mortgage loans:
- 7 years at 5.35%
- 15 years at 5.5%
- 30 years at 5.75%
Use an array for the mortgage data for the different loans. Display the mortgage payment amount followed by the loan balance and interest paid for each payment over the term of the loan. Allow the user to loop back and enter a new amount and make a new selection or quit. Please insert comments in the program to document the program.
Code # 2
Write the program in Java (with a graphical user interface) so that it will allow the user to select which way they want to calculate a mortgage: by input of the amount of the mortgage, the term of the mortgage, and the interest rate of the mortgage payment or by input of the amount of a mortgage and then select from a menu of mortgage loans:
- 7 year at 5.35%
- 15 year at 5.5 %
- 30 year at 5.75%
In either case, display the mortgage payment amount and then, list the loan balance and interest paid for each payment over the term of the loan. Allow the user to loop back and enter a new amount and make a new selection, or quit. Insert comments in the program to document the program.
Code # 3
Write the program in Java (with a graphical user interface) and have it calculate and display the mortgage payment amount from user input of the amount of the mortgage and the user's selection from a menu of available mortgage loans:
- 7 years at 5.35%
- 15 years at 5.5%
- 30 years at 5.75%
Use an array for the mortgage data for the different loans. Read the interest rates to fill the array from a sequential file. Display the mortgage payment amount followed by the loan balance and interest paid for each payment over the term of the loan. Add graphics in the form of a chart. Allow the user to loop back and enter a new amount and make a n/p>
|
|
|
|
|
First, you need to show some code that you have tried and need help with. No one is going to program your homework for you. Are you able to use an IDE like NetBeans to create your GUI, or are you just supposed to code the GUI in text files?
I would suggest that if you really want some EXCELLENT help, I would buy the following book:
Core Java 2, Volume 1, Fundamentals.
You can purchase this book online (recommend "bookpool.com") or through bookstores like Barnes and Noble. Make sure you get the latest (Seventh) Edition.
There are great examples for coding items exactly like you need in this book if you are only using text files to create your GUI program.
AF Pilot
|
|
|
|
|
Hi,
I am working on a struts application where we are generating a newsletter. Now we need to email this newsletter to subscribers. I thought of doing it using JavaMail class, but from what i know is that it will require some details of an SMTP server to send out the email. Now the hurdle is that I do not have access to the SMTP server of my company.
So is there a way where I can bypass this SMTP server details?? I want to simply trigger my outlook express account and automatically upload the newletter in the body of this email(not as an attachment). After this I can put the recipient address manually and send this email. This way I do not require the SMPT server details.
Is there a way to do this?? Is it possible to do it using JMS or JSF??
modified on Wednesday, January 21, 2009 1:57 AM
|
|
|
|
|
How com if you dont have access to the smtp of the company you are able to access mails through outlook?
The outlook can let you know the smtp details and you can use JavaMail API and also can schedule it to be sent at a particular time and Automate the process.
|
|
|
|
|
I want to copy one file from a given folder to another.
For this I have written the following standard code.
FileInputStream fileIn = null;
FileOutputStream fileOut= null;
File fileOut = new File(filePath + File.separator + outFileName);
try
{
fileIn = new FileInputStream(inFileName);
fileOut.createNewFile();
fileOut= new FileOutputStream(fileOut);
int cByte;
while ((cByte = fileIn .read()) != -1)
{
fOut.write(cByte);
}
}
catch (Exception e)
{ // Give IO Exception }
finally
{
try
{
if (fileIn != null) fileIn .close();
if (fileOut!= null) fileOut.close();
}
catch (Exception any){}
}
But this reading byte algorithm has a performance problem (for large files). Is there a better way to do this?
|
|
|
|
|
Found another method, using the FileChannel for transfering bytes.
|
|
|
|
|
I'm not sure if this is the right forum, as this might be related to either NFS or the underlying FS, but anyways...
I'm going through a number of Folders to find subfolders and the files in those subfolders:
Media_Folder1
|-> subfolder_1 -> File1, file2, etc...
|-> subfolder_2 -> File1, file2, etc...
Media_Folder2
|-> subfolder_1 -> File1, file2, etc...
|-> subfolder_2 -> File1, file2, etc...
...
I use the following code:
File rFolder = new File("/Media_Folder/");
File[] subFolderArray = rFolder.listFiles();
for (int i = 0; i < subFolderArray.length(); i++) {
if (subFolderArray[i].isDirectory()) {
File[] tmpFolderContent = subFolderArray[i].listFiles();
for (int i2 = 0; i2 < tmpFolderContent.length(); i2++) {
myCustomFileClass tmpCustFile = new myCustomFileClass(tmpFolderContent[i2].getPath());
}
....
The problem is that the code above (or a bit more complicated version) is working fine, until a certain point.
Then suddenly the tmpFolderContent array gives a nullpointer exception.
1. The code above (...and then some) creates a MediaObject that contains a StringArray that holds names of all subfolders.
2. Then the code goes through all those subfolders to create a CUSTOM FileObject array (Not the regular java.IO.File class, but a custom one that holds only enough info to create a new java.io.File object). The Custom FileObject ARRAY holds the filename and path of all files in all subfolders.
3. The number of files in each subfolder is never more than 25-30, and the number of subfolders is never more than 10, but the number of MediaObjects is fairly large (450++).
There are some ways I can go around this problem (Like add each object to the database right after it's creation [which is what I want anyways, although I want to do something more with the objects before I do this], but this means creating the objects, store them in DB, read them from db and then change them accordingly).
But I'd rather know what is causing this problem, so I know WHY I need to do it that way .
The strange thing is that it appears on the same media folder, and the exact same subfolder each time.
If I skip this folder, it happens on the next subfolder. So something is reaching it's limit.
I've also tried running the above code on ONLY the failing folder, and then it works just fine. So it's not access restrictions on the folders in question!
At first I thought it was the FileArray that had reached its end, but it has room for a lot more (I amped it up after hitting this problem).
Then I thought it could be the MediaObjectArray that had reached it's end, but after increasing it nothing changed.
So this leaves me 4 more possibilities:
1. The VM runs out of RAM? If so, how do I find/change the amount of RAM set aside for the VM (on Gentoo Linux)?
2. There's a limit to the number of file handles the VM can handle? If so, is there a way to change it?
3. Can the number of available FileHandles be defined by the underlying file system (In this case it's a remote NFS share on ReiserFS & XFS FS).
4. Or am I barking up the wrong tree here? Is there something obvious I'm not seeing here (as it often is ).
I guess it's not very good programming practices to create this many objects and to keep them in RAM like this, but I want to do some more stuff with the objects before they're added to the DB...and RAM means less waiting...
And this is my first Java Project, so give me some slack
Cheers,
Martin
|
|
|
|
|
Just a thought, but I think you may need to create new objects for both subFolderArray and tmpFolderContent before you make an assignment to them. You can't go past the end of the array since Java will take care of that sizing of the array for you.
AF Pilot
|
|
|
|
|
Your program will throw away every tmpCustFile object you create. Is this really what you intended?
Also, I think your //etc. part chopped off some important bits.
Also, why did you ignore standard naming procedures? myCustomFileClass should be MyCustomFileClass, to remind you that it's a class, not an instance.
You said:
TylerD75 wrote: At first I thought it was the FileArray that had reached its end, but it has room for a lot more (I amped it up after hitting this problem).
Then I thought it could be the MediaObjectArray that had reached it's end, but after increasing it nothing changed.
What are the two classes you mention? I did not see those anywhere in your code snippet.
From your words, you are storing objects somewhere. From your code, you are not. Please fix one or the other and maybe we can give a better answer.
Don't let my name fool you. That's my job.
|
|
|
|
|
Hi Guys, I am developing a system for my college's final year project and I plan to use JAVA for this ..
The topic of my system is a food ordering system, can i get some opinions from you guys...about ...
1. You guys should know, the GUI for a food ordering system is quite important since the application will be installed in the PC that placed at the table (in the restaurant), so the customer can order directly without the helps from the waiters, my problem is, Is Java good enough for developing such Strong GUI ? I have limited knowledge to Java may be, I found out that the Java's GUI (those built-in one like the provided by the JAVA APIT) is quite bored.... it not really looks like something that is for strong User Interaction....
2. Regarding to question 1, if I develop this food ordering system with java APPLET.... or the JAVA FX... will it be better?
Guys... I need your opnions ^.^" any opinions regarding to this food ordering system..... thanks for the time to read this message...
|
|
|
|
|
You don't have to develop your Java app just for the Web, you can make it a stand-alone app and run it on your PC, and if you have the PC networked (let's say to the "kitchen"), then the order can be read there and processed. I would suggest you take a look at www.java.sun.com --- there are many tutorials on there, and if you want a web-based app, they have an "ordering system" tutorial, with code, that you can base your application on.
Good luck!
AF Pilot
|
|
|
|
|
this is my first smart card project. i have to program the card in java using the API,i want the code that will allow the card to communicate to the pc.pls the code should support the API . that is what i am required to use for the project.
thank you.
|
|
|
|
|
what type/brand etc of smart card ?
Most of these gizmo's come with some sort of API from the manufacturer that has samples of how to use it - so the manufacturer's web-site or rep will usually be able to help you
'g'
|
|
|
|
|
i want to know the code of Find numbers in a given string with java
|
|
|
|
|
what kind of number ? integer ? float ?
Integer i = Integer.parseInt("4");
|
|
|
|
|
I don't find a suitable method to write ArrayLists to a text file. Does each attribute of the class objects that make up the ArrayList have to be written separately? When I wriye the class object of the ArrayList, it just writes out the memory location. Any advice would be much appreciated.
Thank you.
AF Pilot
|
|
|
|
|
you have to loop through the array list and get each array and print it through loop two
for example
private void printArryList(ArrayList<string[]>someList)
{
int counter=0;
for (int i = 0; i < someList.size(); i++) {
System.out.print("["+(++counter)+"]");
for (int j = 0; j < someList.get(i).length; j++) {
System.out.print(someList.get(i)[j]+" ");
}
System.out.println();
}
}
|
|
|
|
|
Thank you very much. I couldn't find much about writing out an ArrayList to a file in any of the Java documentation or tutorials (that appeared understandable to me, anyway). Much appreciated.
AF Pilot
|
|
|
|
|
Hello Friends,
I am looking for a solution to extract following meta data information from WMV file
1. Width
2. Height
3. Duration
4. Bit Rate
Can anyone please suggest me how I can start my RnD journey to achieve this solution.
Any help would be highly appreciated.
Thank You,
Java Developer - First Time
|
|
|
|
|
i dont know the exact program , but still i use Mediainfo . To download mediainfo.exe it will shows bitrate , size,bandwodth .. etc..
Thanks
mani.G
|
|
|
|
|
You need to learn about the format itself. Try Wikipedia for starters:
http://en.wikipedia.org/wiki/Windows_Media_Video[^]
Once you know the format, you'll need to look into Java file handling routines.
Don't let my name fool you. That's my job.
|
|
|
|
|
Hello guys
i am new to java and i have some problem that going to make my head explode
i am stuck on this thing for a week now
i need to read data file by column not by lines
for example
i have the following data file
6, 148, 72, 35, 0, 336, 0627, 50, 2
8, 183, 64, 0, 0, 233, 0672, 32, 2
1, 85, 66, 29
1, 89, 66, 23, 94, 281, 0167, 21, 1
0, 137, 40, 35, 168, 431, 2288, 33, 2, 10, 9, 125
5, 116, 74, 0, 0, 256, 0201, 30, 1
i need to read it coulmn by coulmn and store it to arrays
for exaample the first array would be {6,8,1,1,0,5} and so on
all what i have done is read it line by line and thats not working for me
this what i've done so far
public class VariableTransformation
{
private String FileName = "";
private FileReader FileReader;
private BufferedReader buffFile;
private ArrayList<string[]> attrDomainList = new ArrayList<string[]>();
private String[] item=null;
public static void main(String[] args)
{
VariableTransformation tds = new VariableTransformation();
Scanner input=new Scanner(System.in);
System.out.println("===============================================");
System.out.print("Enter the file name>> ");
String filename;
filename=input.next();
tds.fileLoad(filename);
System.out.println("===============================================");
}
public void fileLoad(String fileName)
{
String line = "";
String[] attrDomain;
FileName = fileName;
System.out.println("> Reading File..");
try {
int lineCount=0;
int size=0;
FileReader = new FileReader(FileName);
buffFile = new BufferedReader(FileReader);
try {
while((line = buffFile.readLine()) != null)
{
item = line.split(",");
size=item.length;
attrDomain=new String[size];
for (int i = 0; i < item.length; i++) {
attrDomain[i]=item[i];
}
attrDomainList.add(attrDomain);
lineCount++;
}
printData(attrDomainList);
System.out.println("> Finish File Reading.");
System.out.println("Number of Lines>> "+lineCount);
System.out.println("===============================================");
}
catch (IOException e) {
System.out.println(e.getStackTrace().toString());
System.out.println("# Error while reading file .");
}
finally
{
try {buffFile.close();} catch (IOException e) {e.printStackTrace();}
try {FileReader.close();} catch (IOException e) {e.printStackTrace();}
}
} catch (FileNotFoundException e) {
System.out.println("> Error. Target File Don't exist.");
e.printStackTrace();
}
}
private void printData(ArrayList<string[]> dataFile )
{
int Counter=0;
for (int i = 0; i < dataFile.size(); i++) {
System.out.print("["+(++Counter)+"] ");
for (int j = 0; j < dataFile.get(i).length; j++) {
System.out.print(dataFile.get(i)[j]+" ");
}
}
}
}
HELP PLEASE
|
|
|
|
|
|
you're on a forum for help about Java programming... so, what's your question ?
|
|
|
|
|
My question was what Java-programmers think about unusual approach to Java-programming which is described in the article above
|
|
|
|
|