Skip to content

Commit 8e0a55d

Browse files
TavienTavien
authored andcommitted
Fixed issues and pull request
1 parent 583006b commit 8e0a55d

File tree

6 files changed

+89
-0
lines changed

6 files changed

+89
-0
lines changed

Compound Interest/Problem.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
A person invests 1000.00 in a savings account yeilding 5 percent interest. Assuming that all interest is left on deposit in the account, calculate and print the amount of money in the account at the end of each year for 10 years. Use the following formula for determining these amounts:
2+
a = p(1+r)^n
3+
where
4+
p is original amount invested (principal)
5+
r is the annual interest rate
6+
n is the number of years
7+
a is the amount on deposit at the end of n years

Compound Interest/Solution.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include <iostream>
2+
#include <iomanip>
3+
#include <cmath>
4+
using namespace std;
5+
6+
int main()
7+
{
8+
double amount;
9+
double p = 1000.0;
10+
double r = .05;
11+
12+
cout <<" Year: " << setw(21) <<" Deposit amount"<<endl;
13+
cout << fixed << setprecision(2);
14+
15+
16+
for (int n =1; n <=10;n++)
17+
{
18+
int a = p * pow(1.0 + r, n);
19+
cout<< setw(4) << n << setw(21) << a <<endl;
20+
21+
}
22+
23+
24+
system("pause");
25+
return 0;
26+
}

Port Scanner (Python)/Problem.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Create a port scanner

Port Scanner (Python)/Solution.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import socket
2+
import subprocess
3+
import sys
4+
from datetime import datetime
5+
6+
subprocess.call('cls', shell=True)
7+
8+
# ask for input
9+
10+
remoteServer = raw_input("Enter a remort host to scan: ")
11+
remoteServerIP = socket.gethostbyname(remoteServer)
12+
13+
print ("-"*60)
14+
print ("Please wait, scanning remote host", remoteServer)
15+
print ("-"*60)
16+
17+
#check when time began
18+
t1=datetime.now()
19+
20+
#try
21+
try:
22+
for port in range(1,1025):
23+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
24+
result = sock.connect_ex((remoteServerIP,port))
25+
if result ==0:
26+
print("Port {}: Open").format(port)
27+
sock.close()
28+
29+
except KeyboardInterrupt:
30+
print("You pressed Ctrl + C")
31+
sys.exit()
32+
33+
except socket.gaierror:
34+
print("Hostname could not be resolved.")
35+
sys.exit()
36+
37+
except socket.error:
38+
print(" Couldnt connect to server")
39+
40+
t2= datetime.now()
41+
42+
total = t2-t1
43+
44+
print (" scan completed in ", total)
45+
46+
47+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.Write a single line of python code that would satisfy this situation: You�re ordering some supplies from a store, and you need to figure out what the total price is. The supplies cost $10. You have a 30% discount at this store, state tax is 5%, and shipping will be $7.50.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
Supplies_cost = 10
3+
Discount = Supplies_cost*(30/100)
4+
State_tax = Supplies_cost*(5/100)
5+
Shipping_cost= 7.50
6+
Total = (Supplies_cost - Discount)+ State_tax + Shipping_cost
7+
print Total

0 commit comments

Comments
 (0)