Notice: Welcome to TinyChan, an account has automatically been created and assigned to you, you don't have to register or log in to use the board, but don't clear your cookies unless you have set a memorable name and password. Alternatively, you can restore your ID. The use of this site requires cookies to be enabled; please cease browsing this site if you don't consent.

TinyChan

Topic: programming?

+Anonymous A4.9 years ago #58,840

how do i write a code to sort object's Z order based on their position to camera, rotate them based on the camera's position and direction, and then build a view based on the camera?

no need to write th whole thing, just the key stuff

+Anonymous B4.1 years ago, 9 months later[T] [B] #626,893

import java.text.NumberFormat;

import java.util.Scanner;

public class FutureValueApp

{

   public static void main (String[] args)

{  

   System.out.printIn("Welcome to the Future Value Calculator");

    System.out.printIn();

// get a Scanner object to scan for user input

   Scanner sc = new Scanner (System.in);

   String choice = "y";

   while (choice.equalsIgnoreCase("y"))

{

   // get input from user

   System.out.print("Enter monthly investment:    ");

   double monthlyInvestment = sc.nextDouble();

   System.out.print("Enter number of years:    ");

   int years = sc.nextInt();

   // convert all input values to months

   double monthlyInterestRate = interestRate / 12 / 100;

   int months = years * 12;

   // call method to calculate future value

   double futureValue = calculateFutureValue(monthlyInvestment, monthlyInterestRate, months);

   // format and display the result

   NumberFormat currency = NumberFormat,getCurrencyInstance();

   System.out.printIn ("Future value:    " 
+ currency.format(futureValue) + "\n");

   // see if the user wants to continue

   System.out.print("Continue? (y/n):  ");

   choice = sc.next();

   System.out.printIn();

}

}

private static double calculateFutureValue (double monthlyInvestment, double monthlyInterestRate, int months)

{

   double futureValue = 0;

   for (int i = 1; i <= months; i++)

{

   futureValue = (futureValue + monthlyInvestment) * (1 + monthlyInterestRate);

}

   return futureValue;

}

}


(mod edit: put in code tags)

(Edited 8 hours later by a moderator.)

Start a new topic to continue this conversation.
Or browse the latest topics.

:

You are required to fill in a captcha for your first 5 posts. Sorry, but this is required to stop people from posting while drunk. Please be responsible and don't drink and post!
If you receive this often, consider not clearing your cookies.



Please familiarise yourself with the rules and markup syntax before posting.