Hello everyone of DaniWeb!! I have an issue with the good old Mortgage Calculator I need to make this list, but i am not sure what i am doing wrong. any help? Here is the assignment

Write the program in VB.Net (not Web based) and have it accept user input of the amount, term and interest rate. Display the mortgage payment amount. Then, list the loan balance and interest paid for each payment over the term of the loan. The list will be longer than the screen, so use loops to display a partial list, hesitate, and then display more of the list. Insert comments to document the program.

Here is my code. I am not sure what i am doing wrong. Thanks

[code=vb.net]
Public Class MortCalc

Private Sub clearForm()
    txtAmount.Text = "Enter Amount"
    txtRate.Text = "Enter Interest Rate"
    txtYears.Text = "Enter Years"
    txtMonthlyPayment.Text = ""
End Sub

Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
    Me.Close()
End Sub

Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click
    'Calculate the Monthly Payment'
    Dim dblAmount, dblMonthlyRate, dblMonths, dblMonthlyPayment As Double
    'Convert input values to numeric values'
    dblAmount = CDbl(txtAmount.Text)
    dblMonthlyRate = CDbl(txtRate.Text) / 100 'allows interest rate to be entered whole number'
    dblMonths = CDbl(txtYears.Text)
    'Format input values'
    txtAmount.Text = FormatCurrency(dblAmount)
    txtRate.Text = FormatPercent(dblMonthlyRate)
    txtYears.Text = FormatNumber(dblMonths)
    'Calculate payment'
    'Results for listbox should be new loan balance and interest rate'
    Dim PVal, FVal, mPayments As Integer
    Dim APR, iPayment, TotInt As Double
    Dim pPayment, ...

Can anyone help me here. I am not sure what i am doing wrong.

Hello everyone of DaniWeb!! I have an issue with the good old Mortgage Calculator I need to make this list, but i am not sure what i am doing wrong. any help? Here is the assignment

Write the program in VB.Net (not Web based) and have it accept user input of the amount, term and interest rate. Display the mortgage payment amount. Then, list the loan balance and interest paid for each payment over the term of the loan. The list will be longer than the screen, so use loops to display a partial list, hesitate, and then display more of the list. Insert comments to document the program.

[code=vb.net]
Public Class MortCalc

Private Sub clearForm()
    txtAmount.Text = "Enter Amount"
    txtRate.Text = "Enter Interest Rate"
    txtYears.Text = "Enter Years"
    txtMonthlyPayment.Text = ""
End Sub

Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
    Me.Close()
End Sub

Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click
    'Calculate the Monthly Payment'
    Dim dblAmount, dblMonthlyRate, dblMonths, dblMonthlyPayment As Double
    'Convert input values to numeric values'
    dblAmount = CDbl(txtAmount.Text)
    dblMonthlyRate = CDbl(txtRate.Text) / 100 'allows interest rate to be entered whole number'
    dblMonths = CDbl(txtYears.Text)
    'Format input values'
    txtAmount.Text = FormatCurrency(dblAmount)
    txtRate.Text = FormatPercent(dblMonthlyRate)
    txtYears.Text = FormatNumber(dblMonths)
    'Calculate payment'
    'Results for listbox should be new loan balance and interest rate'
    Dim PVal, FVal, mPayments As Integer
    Dim APR, iPayment, TotInt As Double
    Dim pPayment, TotPrincipal, dblBalance As Double
    PVal = dblAmount
    FVal = 0
    APR = dblMonthlyRate / ...

I put that code in there...but still nothing...not sure what else could be wrong....

So if i replace that code....where am i adding the code for the cr15.txt file. I see what you said to replace, but then after that i am confused.

[QUOTE=Kashaku;1005384]Edit: After re-reading it over and over again I finally see what you actually meant to do. You want to read the text file to output

  1. 7 years at 5.35%
  2. 15 years at 5.5%
  3. 30 years at 5.75%

Give me some minutes to re-answer that part.[/QUOTE]

Thank you....Yeah if you couldnt tell...i do not know much about C++

Thank you!!

[QUOTE=Kashaku;1005350]Because of the '/ ... /'. The rates and years are between those so it is commentary, so that code will not be executed => no output.[/QUOTE]

so if i take out the comment block, does that mean that built the program correctly, and it will function correctly?

When i choose the option 1 to get interest rate and years, nothing comes up...it is blank. Then (with it blank) i can enter one of the options, then i gives me the answer. So i dont think that it is reading the .txt correctly.

I am sorry about that. I did run the program. and it is not working. I should have said that i am not sure why it is not working. Can you help with that? I am not sure how to read in a txt file.

Thank you and sorry again.

I am having a problem writing from a outside file. here is the assignment.

Write the program as an object-oriented C++ program that allows 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%, and 30 year at 5.75% (use an array for the mortgage information and read the interest rates to fill the array from a sequential file). In either case, display the mortgage payment amount. Then, list the loan balance and interest paid for each payment over the term of the loan. On longer term loans, the
list will scroll off the screen. Do not allow the list to scroll off the screen, but rather display a partial list and then allow the user to continue the list. 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.

I am not sure if i am doing it right, of if i am just way off. Can someone help me?

Here is my main file:
[code=c++]

//Jeremy Johnson
//PRG 411
//Instructor: Charles Ford

include "mortgageCalc_JeremyJohnson.h"
include
include
include
include

using namespace std;

int main () {
MortgagePayment totalMort;

double ...

I am having a problem writing from a outside file. here is the assignment.

Write the program as an object-oriented C++ program that allows 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%, and 30 year at 5.75% (use an array for the mortgage information and read the interest rates to fill the array from a sequential file). In either case, display the mortgage payment amount. Then, list the loan balance and interest paid for each payment over the term of the loan. On longer term loans, the
list will scroll off the screen. Do not allow the list to scroll off the screen, but rather display a partial list and then allow the user to continue the list. 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.

I am not sure if i am doing it right, of if i am just way off. Can someone help me?

Here is my main file:
[code=c++]
//Jeremy Johnson
//PRG 411
//Instructor: Charles Ford

include "mortgageCalc_JeremyJohnson.h"
include
include
include
include

using namespace std;

int main () {
MortgagePayment totalMort;

double ...

Thank you!!!! It worked....i am so grateful!!!

So i have been at this program for hours....and still no luck. I have made the changes that were suggested...but i get an answer of inf.....not sure what to do from here. any help

[QUOTE=Salem;984176]void[/QUOTE]

Okay, i changed that, now i am getting the answer of inf??? Not sure what is wrong, or what that means? Any help now?

I called it in the second set of code.

Hey everyone of the c++ world. I am a little stuck. Here is what i am suppose to be doing.

Write the program as an object-oriented C++ program that calculates and displays the mortgage payment amount from user input of the amount of the mortgage, the term of the mortgage, and the interest rate of the mortgage. Allow the user to loop back and enter new data or quit. Insert comments in the program to document the program.

Now, with this here are the instructions from the instructor:

"The following instructions tell you how I want your programs submitted for grade. Because we are doing the beloved mortgage calculator as an Object Oriented Program in C++, you will be submitting 3 files for each assignment. 1 header file, (.h), 1 source file, that defines the methods you declare in your header file, (.cpp), and 1 main source file, which will have your main function in it. (also .cpp).

The header file is where your class declaration appears. As a rule, it should have the same name as the class, but in our case, I'll also want your name incorporated as part of the file name. (makes it easier for me to get everything in the right place).
The source file that defines your class should have the same name as the header file, but will have a .cpp extension.
The main file, (sometimes called the driver) should have the word main and your name incorporated as part of the file ...

So my assignment is to go a little farther in this Mortgage calculator. by the way thank you for all the help thus far. I am trying to get this right, but can seem to get the math right.

Here is the assignment:
Write the program as a procedural C++ program. Calculate and display the mortgage payment amount using the amount of the mortgage, the term of the mortgage, and the interest rate of the mortgage as input by the user. Then, list the loan balance and interest paid for each payment over the term of the loan. On longer-term loans, the list will scroll off the screen. Do not allow the list to scroll off the screen, but rather display a partial list and then allow the user to continue the list. Allow the user to loop back and enter new data or quit. Insert comments in the program to document the program.

I have the code built, it compiles, but half way through the list it shows "0", and i dont know where i am messing that up. Can you please help!!

Thanks

[CODE=C++]

include
include

using namespace std;

int main () {
// defines varibles
double principle = 0.0;
double interest = 0.0;
double years = 0.0;
float total = 0.0;
char quit;

do {
    do {
    // user input
    cout << "Enter interest rate:";
    cin >> interest;
    cout << endl;
    if (! cin) {
        cout << "\nInvalid Interest...Please enter valid interest rate ";
        interest ...

Hey Guys. Thank you all for all the guidance and help. I think i have the most of this figured out. The only issue that i am having is sorting with the bubble sort i created to sort the title alphabetically. Any last help would be great. Again thank you all for the support and help thus far.

[ICODE]
public class VideoTitleRating {

public VideoTitleRating() {
}

public void sortRatingArray (int [] ratingArry, String[] videoArry) {

    String tmpTitle;
    int rating;
    int temp = 1;

    for (int a = 0; a < ratingArry.length - 1; a++){
        for (rating = 0; rating < ratingArry.length - 1; rating++) {
            if (ratingArry [rating] < ratingArry [rating + 1]) {
                temp = ratingArry [rating];
                ratingArry [rating] = ratingArry [rating + 1];
                ratingArry [rating + 1] = temp;
            }
        }
    }

    for(int i = 0; i < videoArry.length; i++) {
        for(int j = 0; j < videoArry.length -1 -i; j++) {
            if(videoArry[j].compareTo(videoArry[j + i]) > 0) {
                tmpTitle = videoArry[j];
                videoArry[j] = videoArry[j + 1];
                videoArry[j+1] = tmpTitle;
            }
        }
    }
}

public void displayArray (int [] ratingArry, String[] videoArry){

    for (int rating = 0; rating < ratingArry.length; rating++){
        System.out.println (ratingArry [rating] + " - " + videoArry[rating]);
    }
    for(int tmpTitle = 0; tmpTitle < videoArry.length; tmpTitle++) {
        System.out.println (ratingArry [tmpTitle] + " - " + videoArry[tmpTitle]);
    }
}

public static void main(String[] args) {

    String [] videoTitle = {"Terminator 3", "Clerks 2", "Wedding Crashers",
    "Mallrats", "My Best Friends Girl" };
    int[] videoRating = {3, 5, ...

I spoke with the instructor and he said he wants the two arrays in the code. (I told him what i thought about the 1 array, but he killed that idea). I have started to figure it out. I needed to sort it using a bubble sort method. i figured out the first part and that was the ratings, but am having an issues sorting the titles. I did start over so my code is different from the first one i posted earlier but here is what i have thus far, any more help will be great.

[ICODE]

public class VideoTitleRating {

public VideoTitleRating() {
}

public void sortRatingArray (int [] pIntArr) {

    int rating;
    int temp = -1;

    for (int a = 0; a < pIntArr.length - 1; a++){

        for (rating = 0; rating < pIntArr.length - 1; rating++) {

            if (pIntArr [rating] > pIntArr [rating + 1]) {

                temp = pIntArr [rating];
                pIntArr [rating] = pIntArr [rating + 1];
                pIntArr [rating + 1] = temp;
            }
        }
    }
}

public void displayArray (int [] pIntArray)
{
    for (int rating = 0; rating < pIntArray.length; rating++)
    {
        System.out.println ("Array[" + rating + "]: " + pIntArray [rating]);
    }
}

public static void main(String[] args) {

    String [] videoTitle = {"Terminator 3", "Clerks 2", "Wedding Crashers",
    "Mallrats", "My Best Friends Wedding" };
    int[] videoRating = {3, 5, 2, 5, 4};

    BubbleSort sortIntArray = new BubbleSort ();
    System.out.println ("Before Sorting");
    sortIntArray.displayArray (videoRating);

    sortIntArray.sortIntArray (videoRating);

    System.out.println ("\nAfter Sorting");
    sortIntArray.displayArray (videoRating);
    System.exit (0); ...

Alright...maybe i don't know as much as I claim or think :(. I am still having major problems. I have got the video class done (I think....I'll post what i have), now i am having issues with the VideoStore class...
I think i am going to become a seamstress....

Here is what i have so far. Maybe I am way off.

public class Video {

    String[] movieTitle = new String[5];
    int[] movieRating = new int[5];

    public Video(){

    }

    public Video(String[] j_movieTitle, int[] j_movieRating){

        movieTitle = j_movieTitle;
        movieRating = j_movieRating;
    }

    public void setMovie(String[] j_movieTitle){
        movieTitle = j_movieTitle;
    }

    public String[] getMovie() {
        return(movieTitle);
    }

    public void setRating(int[] j_movieRating) {
        movieRating = j_movieRating;
    }

    public int[] getRating() {
        return(movieRating);
    }

}

LevelSix-

Thank you. I will post something within the hour. If i have problems...well i will be back

Thank you again!

I will post what i have in just a little bit. I think I have an idea of what i need to do. Maybe when i post what i have it will help with what I am doing wrong.

Thanks everyone for the help

[QUOTE=LevelSix;842444]What it appears you need to do is simply create one array, of type Video. Video will be a class you have to write, simple enough: Constructor with the two parameters and then return methods.

Once this class and the arrays are constructed you can construct new Video objects and load them into an array.[/QUOTE]
That is the problem that i am having. I am not understanding those parts of it. I am very new and the instructor isnt very helpful. And when you say to have the constructor with two paramerters how would i do that?

Thanks again for the help!

Here is my assignment:

Write a class named 'Video' that has two attributes, a title (type String) and rating (type int). Then write an application class named 'VideoStore' that first creates an array consisting of 5 video objects, then display the list three times; first unsorted, then sorted by title and finally sorted by rating.

I understand an array, i understand how to make an array, and i understand how to display the array. My problem is that i don't understand how to combine the two arrays to create this list that my instructor is looking for. I am not looking for a straight answer, but if there is any resources that you can post or maybe a dummy code that i can use for reference that would be great. Thanks everyone