Question

Define a problem with user input, user output and mathematical computation.
Include source code and output. If no output explain the reason why and what you are going to do make sure it does not happen again aka learning from your mistakes. (JAVA)

Define a problem with user input, user output and mathematical computation Include source code and output. If no output expla

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Ans: - Here we are taking problem of Simple interest calculation for the given time period.

Simple Interest Definition: - Simple interest is a very common mathematical term which is used in banking sector to calculate the interest for a specified amount for specified amount of time period.

Mathematical Computations: - Simple Interest = (P × R × T)/100  

where P = Principal Amount, R = Annual interest rate, T = Time period or duration for the interest

Problem: - Write a Java program to find the simple interest for the given time period by using the given parameters i.e. principal amount for the interest and rate of the interest.

Pseudocode: -

//pseudocode to calculate the simple interest

Begin //start of the code

Define variables p, r, t, Simple_Interest // initialize variables

Read: p, r, t // input values p,r,t by the user

Compute Simple_Interest as (p*r*t)/100    // calculating simple interest using the formula

Print Simple_interest     // Display result on the screen

End   // end of the program

Code: -

Execute Share Source File STDIN 1 public class Interest 2 { 3 public static void main (String args[]) 4. float p, r, t, si; /

Output: -

1.II Result $javac Interest.java $java -Xmx128M -Xms 16M Interest Simple Interest is: 8750.0

There is decimal after the Output value because we have used the float datatype for defining the variables.

Add a comment
Know the answer?
Add Answer to:
Define a problem with user input, user output and mathematical computation. Include source code and output....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a C program as follows: Single source code file Requests the user to input two...

    Write a C program as follows: Single source code file Requests the user to input two integer numbers Requests the user to make a choice between 0 (add), 1 (subtract), or 2 (multiply) Declares three separate functions Uses a pointer to these three functions to perform the requested action Outputs the result to the screen Submit your program source code file to this assignment. Sample Output Enter first integer number: 15 Enter second integer number: 10 Enter Choice: 0 for...

  • **WRITE IN C# INTERMEDIATE LEVEL CODE A 2ND SEMESTER STUDENT COULD UNDERSTAND WELL** Problem Statement: Write...

    **WRITE IN C# INTERMEDIATE LEVEL CODE A 2ND SEMESTER STUDENT COULD UNDERSTAND WELL** Problem Statement: Write an abstract class called Vacation includes a budget and a destination. It has an abstract method returning by how much the vacation is over or under budget. This class has two non-abstract subclasses: All-Inclusive Vacation brand (such as ClubMed, Delta Vacations, etc) a rating (you can use # of stars) price Piecemeal Vacation set of items (hotel, meal, airfare, etc) set of corresponding costs...

  • Example (4) Trace the following program and find the output >> SOURCE CODE #include <iostream.h> int...

    Example (4) Trace the following program and find the output >> SOURCE CODE #include <iostream.h> int main0 // define two integers int x-3; int y = 4; //print out a message telling which is bigger if (x >y) i cout << "x is bigger than y" << endl: else cout << "x is smaller than y" << endl; return 0; Example (5) Write a C++ program that takes from the user a number in SR (Saudi Riyal) then the program...

  • This question deals with extending already existing Java code via a while loop. Ask the user...

    This question deals with extending already existing Java code via a while loop. Ask the user how many year inputs he wants to check - an integer. Assume that the user always gives an input which is between 1 and 5 (inclusive). Next, ask the user for K number of year inputs where K = the number user has given as input before (inside a while loop). Check for each year input whether that year is a leap year or...

  • Run the code in Linux and provide the screenshot of the output and input #include <signal.h>...

    Run the code in Linux and provide the screenshot of the output and input #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <arpa/inet.h> #include <sys/types.h> #include <sys/socket.h> static void cleanup(); static void docleanup(int signum); static const char *SERVER_ADDR = "127.0.0.1"; static const int SERVER_PORT = 61234; static int cfd = -1; int main(int argc, char *argv[]) { struct sockaddr_in saddr; char buf[128]; int bufsize = 128, bytesread; struct sigaction sigact; printf("client starts running ...\n"); atexit(cleanup); sigact.sa_handler =...

  • Design (pseudocode) and implement (source code) a program (name it IncomeTax) that reads from the user...

    Design (pseudocode) and implement (source code) a program (name it IncomeTax) that reads from the user annual income, as integer value, and calculates the income tax based on the tax table below. Income Tax bracket Annual income <= $50,000 5% $50,000 < Annual income <= $200,000 10% $200,000 < Annual income <= $400,000 15% $400,000 < Annual income <= $900,000 25% $900,000 < Annual income 35% The program output should include the entered annual income followed by the applied tax...

  • Conditional statements, loops, reading from file, user defined functions.

    # in C Project objective: Conditional statements, loops, reading from file, user defined functions.**Submit source code (prog3.c) through CanvasOne source code file(unformatted text) will be submittedHere is INCOMPLETE code to get started: prog3.cHere is input.txt file: input.txtThe file name must match the assignmentThe code should be tested and run on a Microsoft compiler before it is uploaded onto CanvasThe code must be submitted on time in order to receive credit (11:59PM on the due date)Late submissions will not be accepted or gradedAll...

  • Create a code that performs the following actions: l. Define the flow rate and height of tank 2./ Have the user input a value for radius 3./ Ask the user for a value of many minutes the tan...

    Create a code that performs the following actions: l. Define the flow rate and height of tank 2./ Have the user input a value for radius 3./ Ask the user for a value of many minutes the tank should fill for 4. Clear the command window (clc) after all of the input commands are given 5. Call in a "tank solver" function that performs the following Takes F, h, r, and t final as inputs, and there are no variable...

  • Hello, I am wondering what the source code for this problem would be. Thank you so...

    Hello, I am wondering what the source code for this problem would be. Thank you so much. You will write a java program using the Eclipse IDE. The program will allow a user to perform one of two options. The user can look up the dates for a given zodiac sign or enter a date and find what sign corresponds to that date. SIGN START DATE END DATE Aries 3/21 4/19 Taurus 4/20 5/20 Gemini 5/21 6/20 Cancer 6/21 7/22...

  • Java programming only Create a Java program that inputs a grade from the user. The grade input from the user will be an...

    Java programming only Create a Java program that inputs a grade from the user. The grade input from the user will be an integer. Once the input is stored, use an if-else-if block of code to determine the letter grade of the inputted integer grade. Do not use a bunch of if statements by themselves to solve this problem. You will print an error message for inputs greater than 100 and for inputs less than 0. Both errors must be...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT