write a program to perform the following in C
In: Computer Science
URL routing in relation to server-side development. How does it differ from routing physical files?
In: Computer Science
Hello,
In C++ how would I get it to ignore a percent sign in an
input.
cout << "Enter the annual interest rate in %: ";
cin >> interestRate;
I want the user to input "3%" for example but having the % sign
makes the program terminate.
How can I get it to just read 3% (or any percent number) as just
"3"
In: Computer Science
hii there ..
i was thinking of making project in C++ on topic payroll management
system ..
what can be included in that ?
wht are main aspects of this topic ??
thankx
In: Computer Science
The split method in the String class returns an array of strings
consisting of the substrings split by the delimiters. However, the
delimiters are not returned. Implement the following new method
that returns an array of strings consisting of the substrings split
by the matching delimiters, including the matching
delimiters.
public static String[] split(String s, String regex)
For example, split("ab#12#453", "#") returns ab, #, 12, #, 453 in
an array of String, and split("a?b?gf#e", "[?#]") returns a, ?, b,
?, gf, #, and e in an array of String.
Write a test program to show that your split method works
properly.
PLEASE DO THE QUESTION IN A SIMPLER WAY
In: Computer Science
1) Write a function equation(A, B) that returns a value C where A + B = C
a. Write the equation function:
b: Write the output of your function for a few values:
2) Write a non-recursive function called fact(n) that computes n! Try computing fact(n) for large values. Can you find the maximum value for n your program will compute correctly?
a) Write your fact function:
b) Write the output of your function for a few values:
3)
Write a function called printThem(n) which print the numbers from 1 to n with the following conditions:
In place of multiples of 3 print three.
In place of multiples of 5, print five.
If a number is divisible by both 3 and 5 print fifteen.
Do not print multiples of 7 (even if a multiple of 3)
Display 15 numbers per line. Include sample output for n=50. Note that 50 should be the parameter when you call your printThem function, not part of the function itself.
a) Print Them(n) function:
b) Write your output function
4)
Write a function makeChange(amount) that for a given amount of money makes change for that amount in nickels, dimes, and quarters. You can assume the amount will be 100 cents or less. For example:
Change for 100:
nickels: 4
dimes: 3
quarters: 2
When you are done, think about how you could calculate all possible ways to make change for that amount. That increases the complexity considerably, so it is not required for full credit.
a) Write the output of your makeChange function
b) Write your makeChange function:
*****************************************************************************************************************************************
Please answer these questions in C and write comments on why some actions are being done! Please give which function to write to each problem as well as the output function!! Thank you so much!
In: Computer Science
I want to print out the array as well as its intersection, and also it doesn't show the time elapsed after 100,000
Missing is: 1,000,000 and 10,000,000
import java.util.Random;
import java.util.HashSet;
import java.util.Arrays;
public class array_intersect {
public static void main(String[] args)
{
for(int i=1000; i <= 10000000; i= i*10)
{
Integer[] array1 = generate_random_array(i);
Integer[] array2 = generate_random_array(i);
long startTime = System.nanoTime();
get_intersection(array1, array2);
long stopTime = System.nanoTime();
long elapsedTime = stopTime - startTime;
System.out.println("Time elapsed for dataset of " + i + " points :
"+ elapsedTime + " in nanoseconds");
}
}
public static Integer[] generate_random_array(int size)
{
Random rand = new Random();
Integer[] return_array = new Integer[size];
for(int i=0;i< size ; i ++)
{
return_array[i] = rand.nextInt(size);
}
return return_array;
}
public static Integer[] get_intersection(Integer[] array1,
Integer[] array2)
{
HashSet<Integer> set = new HashSet<>();
set.addAll(Arrays.asList(array1));
set.retainAll(Arrays.asList(array2));
Integer[] intersection = {};
intersection = set.toArray(intersection);
return intersection;
}
}
In: Computer Science
Design a class named Account that contains:
■ A private int data field named id for the account (default
0).
■ A private double data field named balance for the account
(default 0).
■ A private double data field named annualInterestRate that stores
the current
interest rate (default 0). Assume all accounts have the same
interest rate.
■ A private Date data field named dateCreated that stores the date
when the account was
created.
■ A no-arg constructor that creates a default account.
■ A constructor that creates an account with the specified id and
initial balance.
■ The accessor and mutator methods for id, balance, and
annualInterestRate.
■ The accessor method for dateCreated.
■ A method named getMonthlyInterestRate() that returns the monthly
interest rate.
■ A method named getMonthlyInterest() that returns the monthly
interest.
■ A method named withdraw that withdraws a specified amount from
the account.
■ A method named deposit that deposits a specified amount to the
account.
Implement the class in Java as required by the design above. (Hint:
The method getMonthlyInterest() is to return monthly interest, not
the interest rate. Monthly interest is balance *
monthlyInterestRate and monthlyInterestRate is annualInterestRate /
12. Note that annualInterestRate is a percentage, e.g., like 4.5%.
You need to divide it by 100.)
Write a test program that creates an Account object with an account
ID of 1122, a balance of $20,000, and an annual interest rate of
4.5%. Use the withdraw method to withdraw $2,500, use the deposit
method to deposit $3,000, and print the balance, the monthly
interest, and the date when this account was created.
PLEASE DO THE QUESTION IN A SIMPLER WAY
In: Computer Science
In: Computer Science
A company’s IT policy states that passwords should contain 14 characters with a mix of letters, numbers, and special characters. After reviewing the implemented policy within the IT system, it is noted that the current security settings stated that passwords only need to be 6 character long. Answer the following questions.
What are the threats?
What are the risks?
How would you mitigate the risks?
In: Computer Science
Perform the following base conversion using division
and remainder method:4 marks
a) 498base10 to base 3
b) 2458base10 =
c) 961base10
d) 21base10 to base
3 5 9 7
In: Computer Science
2. [50] Write a C program to count the total number of commented characters and words in a C file taking both types of C file comments (single line and block) into account.
In: Computer Science
This program is written by Ruby and Please rewrite this program as python.
input_lines = gets.split(" ")
tasizan = input_lines[0].to_i
hikizan = input_lines[1].to_i
cnt=-0
drill=[]
while cnt<tasizan
kazu1 = rand(100)
kazu2 = rand(100)
next if kazu1+kazu2>99
next if drill.include?("#{kazu1} + #{kazu2} =")
drill.push("#{kazu1} + #{kazu2} =")
cnt+=1
end
cnt=0
while cnt<hikizan
kazu1 = rand(100)
kazu2 = rand(100)
next if kazu1 <= kazu2
next if drill.include?("#{kazu1} - #{kazu2} =")
drill.push("#{kazu1} - #{kazu2} =")
cnt+=1
end
puts drill.sample(tasizan+hikizan)In: Computer Science
Describe the difference between IP and Network Access layer in TCP protocol and also explain the control information embedded in these two layers
In: Computer Science
In: Computer Science