Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write two complete java programs to solve the following two problems. Make certain to document your code properly. 1)Combination Combinations in mathematics are the ways

Write two complete java programs to solve the following two problems. Make certain to document your code properly.

1)Combination

Combinations in mathematics are the ways of picking several items from a large group, where order does not matter. For example, there are 6 ways to pick 2 items from a group of 4 items. In mathematics, the number of combinations of picking k items from a group of n items is denoted as image text in transcribed, nCk, or image text in transcribed.

image text in transcribed

Write a method named getNumberOfCombinations(int n, int k) for computing image text in transcribed using following header:

public static BigInteger getNumberOfCombinations(int n, int k)

Write a test program that prompts the user to enter n and k and displays image text in transcribed as shown in the following sample run:

Enter n: 4

Enter k: 2

The C(n, k) is 6

Enter n: 500

Enter k: 45

The C(n, k) is 30847877486165278042972675969000464272239600770627726467491808400

Line Editor

Input a String from the user, then input a command to modify the line and finally output the resulting string after performing the command.The commands formats are

Delete: d-

Append: a

Replace: r:

The delete command removes all the characters from the start_index to the end_index (both integers)The first character in the string is start_index is 0. Verify that end_index is greater than the start_index.If the end_index is longer than the length of the string, use the length of the string, Examples

Input String=Ritgers State University

d10-20

OutputStringRitgers Stity

Input String=RitgersState University

d5-11

OutputStringRogete University

Append command just adds the string following the letter a to the end of the current string

Input String=Ritgers State University

as Hillcats

OutputStringRitgers State Universitys Hillcats

Input String=Ritgers State Universitya---Go Cats!

OutputStringRitgers State University---Go Cats!

The replace command matches every occurrence of the first string and replaces it with the second string. There may be multiple matches on one string.The string may contain a space so the separator between the strings is the colon (:)character.It is case sensitive

Input String=Ritgers State University

rer:XXXX

OutputStringRogXXXXs State UnivXXXXsity

Input String=Ritgers State University

rER:XXXXOutputStringRogers State University

Input String=Ritgers State UniversityrUniversity:College

OutputStringRitgers State College

n! Onk!n - k)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions