logo

Introduction to Programming with Java - Solved Assignments

   

Added on  2022-11-17

12 Pages1129 Words91 Views
Running head: INTRODUCTION TO PROGRAMMING
Introduction to programming
Name of the Student
Name of the University
Authors note
Introduction to Programming with Java - Solved Assignments_1
INTRODUCTION TO PROGRAMMING
1
Q1.
public class Question1 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int sharenum = 1000;
//number of shares
double btstockprice = 32.87;
//buy price of stocks
double commrate = .02;
//commission rate
double sstockprice = 33.92;
double buyamnt = (sharenum * btstockprice);
double buycomm = ((sharenum * btstockprice) * commrate);
double salamnt = (sharenum * sstockprice);
double salcomm = ((sharenum * sstockprice) * commrate);
Introduction to Programming with Java - Solved Assignments_2
INTRODUCTION TO PROGRAMMING
2
System.out.println(" Total amount paid by Joe for purchsing Stock \t $" +
buyamnt);
System.out.println(" Total amount paid by for Brockers Commision \t $" +
buycomm);
System.out.println(" Total amount acquired by Joe by selling the Stock \t $" +
salamnt);
System.out.println(" Total amount paid to broker after sales of stocks \t $" +
salcomm);
System.out.println(" Total profit amount after the sale of Stocks \t $" +
(salamnt - buyamnt));
}
}
Introduction to Programming with Java - Solved Assignments_3
INTRODUCTION TO PROGRAMMING
3
Q2.
public class Q2 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int numyears;
int months = 12;
double[] rainfall = new double[12];
Introduction to Programming with Java - Solved Assignments_4

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Object Oriented Programming with Java
|9
|1142
|153

Java Program to Draw Shapes - Desklib
|10
|1283
|284

Design: The First Step for Solving the Problem
|4
|439
|11

Java Programming Assignments with Solutions
|9
|904
|164

Java Assignment Codes
|52
|5341
|240

Major Steps for Solving the Problem
|2
|528
|11