App is crashing at startup? Any idea? Thanks!
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.Random;
public class MainActivity extends AppCompatActivity {
private EditText teamOneText;
private EditText teamTwoText;
private Button selectButton;
private TextView resultView;
Random r = new Random();
ArrayList<EditText> editTextList = new ArrayList<>();
ArrayList<String> editTextValues = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
editTextList.add(teamOneText);
editTextList.add(teamTwoText);
for(int i=0;i<editTextList.size();i++){
editTextValues.add(editTextList.get(i).getText().toString());
}
teamOneText = findViewById(R.id.team_one);
teamTwoText = findViewById(R.id.team_two);
resultView = findViewById(R.id.result_view);
selectButton = findViewById(R.id.select_button);
selectButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
resultView.setText(editTextValues.get(r.nextInt(editTextValues.size())));
}
});
}
}
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/result_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Result shown here"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.70" />
<Button
android:id="@+id/select_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Select Random Team"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.40" />
<EditText
android:id="@+id/team_one"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName"
android:text="Team's name"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.70"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.15" />
<EditText
android:id="@+id/team_two"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName"
android:text="Team's name"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.70"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.25" />
<TextView
android:id="@+id/team1_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Team 1"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.15"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.16" />
<TextView
android:id="@+id/team2_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Team 2"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.15"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.26" />
</androidx.constraintlayout.widget.ConstraintLayout>
strings.xml
<resources>
<string name="app_name">TeamSelector</string>
</resources>
In: Computer Science
Kaelea, Inc., has no debt outstanding and a total market value of $75,000. Earnings before interest and taxes, EBIT, are projected to be $9,400 if economic conditions are normal. If there is strong expansion in the economy, then EBIT will be 24 percent higher. If there is a recession, then EBIT will be 31 percent lower. The company is considering a $22,500 debt issue with an interest rate of 8 percent. The proceeds will be used to repurchase shares of stock. There are currently 5,000 shares outstanding. Assume the company has a market-to-book ratio of 1.0. a. Calculate return on equity, ROE, under each of the three economic scenarios before any debt is issued, assuming no taxes. (Do not round intermediate calculations and enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.) ROE Recession % Normal % Expansion % b. Calculate the percentage changes in ROE when the economy expands or enters a recession, assuming no taxes. (A negative answer should be indicated by a minus sign. Do not round intermediate calculations and enter your answers as a percent rounded to the nearest whole number, e.g., 32.) %ΔROE Recession % Expansion % Assume the firm goes through with the proposed recapitalization and no taxes. c. Calculate return on equity, ROE, under each of the three economic scenarios after the recapitalization. (Do not round intermediate calculations and enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.) ROE Recession % Normal % Expansion % d. Calculate the percentage changes in ROE for economic expansion and recession. (A negative answer should be indicated by a minus sign. Do not round intermediate calculations and enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.) %ΔROE Recession % Expansion % Assume the firm has a tax rate of 35 percent. e. Calculate return on equity, ROE, under each of the three economic scenarios before any debt is issued. Also, calculate the percentage changes in ROE for economic expansion and recession. (A negative answer should be indicated by a minus sign. Do not round intermediate calculations and enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.) ROE Recession % Normal % Expansion % %ΔROE Recession % Expansion % f. Calculate return on equity, ROE, under each of the three economic scenarios after the recapitalization. Also, calculate the percentage changes in ROE for economic expansion and recession, assuming the firm goes through with the proposed recapitalization. (A negative answer should be indicated by a minus sign. Do not round intermediate calculations and enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.) ROE Recession % Normal % Expansion % %ΔROE Recession % Expansion %
In: Finance
in c++ language
This assignment is to give you practice using structs and sorting.
In competitive diving, each diver makes dives of varying degrees of difficulty. Nine judges score each dive from 0 through 10 in steps of 0.5. The difficulty is a floating-point value between 1.0 and 3.0 that represents how complex the dive is to perform. The total score is obtained by discarding the lowest and highest of the judges’ scores, adding the remaining scores, and then multiplying that total by the degree of difficulty. Write a program to score each of the dives, using the following input and output specifications, and determine the winner of the competition.
Input:
Create the file m7divers.txt using the data given at the end.
The first line contains an integer for the number of divers in
the competition and subsequent lines contain:
Diver’s name (10 characters max, no blanks included), difficulty
(double), and judges’ ratings (nine doubles). There is one line of
data for each diver.
Example file: (This is not the data to use)
| Anne | 2.0 | 8.0 | 8.5 | 8.5 | 8.5 | 9.0 | 9.0 | 9.0 | 9.5 | 9.5 | 124.0 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Sarah | 1.6 | 7.0 | 7.5 | 8.0 | 8.0 | 8.0 | 8.5 | 8.5 | 8.5 | 9.0 | 91.2 |
Output:
The name and difficulty, followed by the scores sorted into increasing order, in tabular form with appropriate headings along with the earned total points for that dive.
Example for sample data above
| NAME | DIFF | SORTED SCORES | POINTS | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Anne | 2.0 | 8.0 | 8.5 | 8.5 | 8.5 | 9.0 | 9.0 | 9.0 | 9.5 | 9.5 | 124.0 |
| Sarah | 1.6 | 7.0 | 7.5 | 8.0 | 8.0 | 8.0 | 8.5 | 8.5 | 8.5 | 9.0 | 91.2 |
At the end of the table, print out the name of the winner of the
competition (the person with the highest points) and his/her final
score.
Hint: Use functions to modularize your program.
Use this data for your input file. download the data from the attachment.
| NAME | DIFF | SORTED SCORES | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Anne | 2.0 | 8.0 | 8.5 | 8.5 | 8.5 | 9.0 | 9.0 | 9.0 | 9.5 | 9.5 |
| Sarah | 1.6 | 7.0 | 7.5 | 8.0 | 8.0 | 8.0 | 8.5 | 8.5 | 8.5 | 9.0 |
| Deborah | 2.3 | 9.0 | 9.0 | 9.5 | 10.0 | 10.0 | 9.5 | 9.5 | 9.5 | 9.5 |
| Kathryn | 2.4 | 9.0 | 9.0 | 9.0 | 9.5 | 9.5 | 9.5 | 9.0 | 8.0 | 8.5 |
| Martha | 2.7 | 9.0 | 9.0 | 9.5 | 9.5 | 9.0 | 8.5 | 8.5 | 8.5 | 8.5 |
| Elizabeth | 2.9 | 8.0 | 8.0 | 7.5 | 8.5 | 8.5 | 8.0 | 8.0 | 7.5 | 8.5 |
| Tina | 2.5 | 8.5 | 8.5 | 8.5 | 8.5 | 8.5 | 8.5 | 8.5 | 8.5 | 8.5 |
In: Computer Science
Minion, Inc., has no debt outstanding and a total market value of $211,875. Earnings before interest and taxes, EBIT, are projected to be $14,300 if economic conditions are normal. If there is strong expansion in the economy, then EBIT will be 20 percent higher. If there is a recession, then EBIT will be 35 percent lower. The company is considering a $33,900 debt issue with an interest rate of 6 percent. The proceeds will be used to repurchase shares of stock. There are currently 7,500 shares outstanding. Assume the company has a market-to-book ratio of 1.0 and the stock price remains constant
. a-1. Calculate return on equity, ROE, under each of the three economic scenarios before any debt is issued, assuming no taxes. (Do not round intermediate calculations and enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)
a-2. Calculate the percentage changes in ROE for economic expansion or recession, assuming no taxes. (A negative answer should be indicated by a minus sign. Do not round intermediate calculations and enter your answers as a percent rounded to the nearest whole number, e.g., 32.)
b-1. Calculate return on equity, ROE, under each of the three economic scenarios after the recapitalization. (A negative answer should be indicated by a minus sign. Do not round intermediate calculations and enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)
b-2. Calculate the percentage changes in ROE for economic expansion and recession after the recapitalization. (A negative answer should be indicated by a minus sign. Do not round intermediate calculations and enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)
Assume the firm has a tax rate of 21 percent.
c-1. Calculate return on equity, ROE, under each of the three economic scenarios before any debt is issued. Also, calculate the percentage changes in ROE for economic expansion and recession. (A negative answer should be indicated by a minus sign. Do not round intermediate calculations and enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)
c-2. Calculate return on equity, ROE, under each of the three economic scenarios after the recapitalization. Also, calculate the percentage changes in ROE for economic expansion and recession, assuming the firm goes through with the proposed recapitalization. (A negative answer should be indicated by a minus sign. Do not round intermediate calculations and enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)
In: Finance
|
Name: |
($ in millions) |
|||||||||||||||||||||||
|
Assets |
December 31, 2016 |
December 31, 2017 |
Dollar Change |
Source or Use Increase/Decrease |
||||||||||||||||||||
|
Current Assets |
||||||||||||||||||||||||
|
Cash |
$ 400 |
$ 500 |
||||||||||||||||||||||
|
Accounts receivable |
1,510 |
1,750 |
||||||||||||||||||||||
|
Inventory |
1,179 |
1,440 |
||||||||||||||||||||||
|
Total Current Assets |
$ 3,089 |
$ 3,690 |
||||||||||||||||||||||
|
Fixed assets |
||||||||||||||||||||||||
|
Net plant and equipment |
$ 5,666 |
$ 6,090 |
||||||||||||||||||||||
|
Total Assets |
$ 8,755 |
$ 9,780 |
||||||||||||||||||||||
|
Liabilities and Owners' Equity |
||||||||||||||||||||||||
|
Current liabilities |
||||||||||||||||||||||||
|
Accounts payable |
$ 880 |
$ 900 |
||||||||||||||||||||||
|
Notes payable |
- |
- |
||||||||||||||||||||||
|
Total Current Liabilities |
$ 880 |
$ 900 |
||||||||||||||||||||||
|
Long-term debt |
1,500 |
1,700 |
||||||||||||||||||||||
|
Total Liabilities |
$ 2,380 |
$ 2,600 |
||||||||||||||||||||||
|
Stockholder's equity |
||||||||||||||||||||||||
|
Common stock and paid-in surplus |
$ 1,000 |
$ 1,000 |
||||||||||||||||||||||
|
Retained earnings |
5,375 |
6,180 |
||||||||||||||||||||||
|
Total Stockholder's equity |
$ 6,375 |
$ 7,180 |
||||||||||||||||||||||
|
Total liabilities and stockholders' equity |
$ 8,755 |
$ 9,780 |
||||||||||||||||||||||
|
Increase in Cash |
||||||||||||||||||||||||
|
Common-size Income Statement |
FYE 12/31/2017 |
|||||||||||||||||||||||
|
Sales |
$10,000 |
100% |
||||||||||||||||||||||
|
Cost of Goods Sold |
5,350 |
53.5% |
||||||||||||||||||||||
|
Operating Expenses |
2,250 |
22.5% |
||||||||||||||||||||||
|
Depreciation |
1,100 |
11.0% |
||||||||||||||||||||||
|
Earnings Before Interest & Taxes |
$1,300 |
13.0% |
||||||||||||||||||||||
|
Interest Expense |
170 |
1.7% |
||||||||||||||||||||||
|
Taxable Income |
$1,130 |
11.3% |
||||||||||||||||||||||
|
Taxes |
230 |
2.3% |
||||||||||||||||||||||
|
Net Income |
$900 |
9.0% |
||||||||||||||||||||||
|
Dividends |
$95 |
1.0% |
||||||||||||||||||||||
|
Addition To Retained Earning |
$ 805 |
8.1% |
||||||||||||||||||||||
|
Major Source |
||||||||||||||||||||||||
|
Major Use |
||||||||||||||||||||||||
|
There are 5 Majors |
Cash Flow Activity |
Compute ratios to 2 decimals except for Working Capital |
December 31, 2016 |
December 31, 2017 |
||||||||||||||||||||
|
Short-term Solvency/Liquidity |
||||||||||||||||||||||||
|
Working Capital |
||||||||||||||||||||||||
|
Current Ratio |
||||||||||||||||||||||||
|
Quick Ratio |
||||||||||||||||||||||||
|
Cash Ratio |
||||||||||||||||||||||||
|
Long-term Solvency/Leverage |
||||||||||||||||||||||||
|
Total Debt Ratio% |
||||||||||||||||||||||||
|
Equity multiplier |
||||||||||||||||||||||||
|
Times Interest Earned Ratio |
||||||||||||||||||||||||
|
Cash Coverage Ratio |
||||||||||||||||||||||||
|
Asset Utilization/Turnover |
||||||||||||||||||||||||
|
Inventory Turnover |
||||||||||||||||||||||||
|
Day's Sales In Inventory |
||||||||||||||||||||||||
|
Receivable Turnover |
||||||||||||||||||||||||
|
Day's Sales in Receivables |
||||||||||||||||||||||||
|
Operating Cycle in days |
||||||||||||||||||||||||
|
Total Asset Turnover |
||||||||||||||||||||||||
|
Profitability |
||||||||||||||||||||||||
|
Profit Margin% |
||||||||||||||||||||||||
|
Return on Assets (ROA)% |
||||||||||||||||||||||||
|
Return on Equity (ROE)% |
||||||||||||||||||||||||
|
ROE - Using Du Point Identity% |
||||||||||||||||||||||||
|
Borrowing Rate |
||||||||||||||||||||||||
|
According to the Short-Term Solvency ratios, has Corbett Corporation's liquidity improved or declined? |
||||||||||||||||||||||||
|
Answer: |
||||||||||||||||||||||||
Balance Sheets of December 31, 2016 and 2017 and Income Statement for the Year Ended December 31, 2017 are given below. Please complete columns Dollar Change, Source or Use Increase/Decrease, Major Source/Major Use, and Cash Flow Activity to prove Increase or decrease in Cash. Compute Short-term Solvency/Liquidity for both years to answer whether Corbett Enterprises’ liquidity has improved or declined. Also, compute Long-term Solvency, Asset Utilization, and Profitability ratios for 2017 since only the 2017 income Statement is given.
In: Finance
1)
Which of the following solutions is a good buffer system?
Which of the following solutions is a good buffer system?
| A solution that is 0.10 M HCN and 0.10 M LiCN | |||||||||||||||||||||
| A solution that is 0.10 M NaCl and 0.10 M HCl | |||||||||||||||||||||
| A solution that is 0.10 M KOH and 0.10 M HNO3 | |||||||||||||||||||||
| A solution that is 0.10 M HNO3 and 0.10 M KNO3 | |||||||||||||||||||||
|
A solution that is 0.10 M HCN and 0.10 M Na Cl 2) Calculate the pH of the solution that results from each of the following mixtures. Part A 55.0 mL of 0.17 M HCHO2 with 70.0 mL of 0.13 M NaCHO2 Express your answer using two decimal places. Part B 115.0 mL of 0.11 M NH3 with 250.0 mL of 0.11 M NH4Cl Express your answer using two decimal places. 3) A 1.0-L buffer solution is 0.125 M in HNO2 and 0.180 M in NaNO2. Part A Determine the concentrations of HNO2 and NaNO2 after addition of 1.5 g HCl. Express your answers using three significant figures separated by a comma. Part B Determine the concentrations of HNO2 and NaNO2 after addition of 1.5 g NaOH. Express your answers using three significant figures separated by a comma. Part C Determine the concentrations of HNO2 and NaNO2 after addition of 1.5 g HI. Express your answers using three significant figures separated by a comma. 4) A ligand is a molecule or ion that acts as a A ligand is a molecule or ion that acts as a
|
In: Chemistry
In: Accounting
The Carolina Cougars is a major league baseball expansion team beginning its third year of operation. The team had losing records in each of its first 2 years and finished near the bottom of its division. However, the team was young and generally competitive. The team’s general manager, Frank Lane, and manager, Biff Diamond, believe that with a few additional good players, the Cougars can become a contender for the division title and perhaps even for the pennant. They have prepared several proposals for free- agent acquisitions to present to the team’s owner, Bruce Wayne.
Under one proposal the team would sign several good available free agents, including two pitchers, a good fielding shortstop, and two power-hitting outfielders for $52 million in bonuses and annual salary. The second proposal is less ambitious, costing $20 million to sign a relief pitcher, a solid, good-hitting infielder, and one power-hitting out- fielder. The final proposal would be to stand pat with the current team and continue to develop.
General Manager Lane wants to lay out a possible season scenario for the owner so he can assess the long-run ramifications of each decision strategy. Because the only thing the owner understands is money, Frank wants this analysis to be quantitative, indicating the money to be made or lost from each strategy. To help develop this analysis, Frank has hired his kids, Penny and Nathan, both management science graduates from Tech.
Penny and Nathan analyzed league data for the previous five seasons for attendance trends, logo sales (i.e., clothing, souvenirs, hats, etc.), player sales and trades, and revenues. In addition, they interviewed several other owners, general managers, and league officials. They also analyzed the free agents that the team was considering signing.
Based on their analysis, Penny and Nathan feel that if the Cougars do not invest in any free agents, the team will have a 25% chance of contending for the division title and a 75% chance of being out of contention most of the sea- son. If the team is a contender, there is a .70 probability that attendance will increase as the season progresses and the team will have high attendance levels (between 1.5 million and 2.0 million) with profits of $170 million from ticket sales, concessions, advertising sales, TV and radio sales, and logo sales. They estimate a .25 probability that the team’s attendance will be mediocre (between 1.0 million and 1.5 million) with profits of $115 million and a .05 prob- ability that the team will suffer low attendance (less than 1.0 million) with profit of $90 million. If the team is not a contender, Penny and Nathan estimate that there is .05 probability of high attendance with profits of $95 mil- lion, a .20 probability of medium attendance with profits of $55 million, and a .75 probability of low attendance with profits of $30 million.
If the team marginally invests in free agents at a cost of $20 million, there is a 50–50 chance it will be a contender. If it is a contender, then later in the season it can either stand pat with its existing roster or buy or trade for players that could improve the team’s chances of winning the division. If the team stands pat, there is a .75 probability that attendance will be high and profits will be $195 million. There is a .20 probability that attendance will be mediocre with profits of $160 million and a .05 probability of low attendance and profits of $120 million. Alternatively, if the team decides to buy or trade for players, it will cost $8 million, and the probability of high attendance with profits of $200 million will be .80. The probability of mediocre attendance with $170 million in profits will be .15, and there will be a .05 probability of low attendance, with profits of $125 million.
If the team is not in contention, then it will either stand pat or sell some of its players, earning approximately $8 million in profit. If the team stands pat, there is a .12 probability of high attendance, with profits of $110 million; a .28 probability of mediocre attendance, with profits of $65 million; and a .60 probability of low attendance, with profits of $40 million. If the team sells players, the fans will likely lose interest at an even faster rate, and the probability of high attendance with profits of $100 million will drop to .08, the probability of mediocre attendance with profits of $60 million will be .22, and the probability of low attendance with profits of $35 million will be .70.
The most ambitious free-agent strategy will increase the team’s chances of being a contender to 65%. This strategy will also excite the fans most during the off-season and boost ticket sales and advertising and logo sales early in the year. If the team does contend for the division title, then later in the season it will have to decide whether to invest in more players. If the Cougars stand pat, the probability of high attendance with profits of $210 million will be .80, the probability of mediocre attendance with profits of $170 million will be .15, and the probability of low attendance with profits of $125 million will be .05. If the team buys players at a cost of $10 million, then the probability of having high attendance with profits of $220 million will increase to .83, the probability of mediocre attendance with profits of $175 million will be .12, and the probability of low attendance with profits of $130 million will be .05.
If the team is not in contention, it will either sell some players’ contracts later in the season for profits of around $12 million or stand pat. If it stays with its roster, the prob- ability of high attendance with profits of $110 million will be .15, the probability of mediocre attendance with profits of $70 million will be .30, and the probability of low attendance with profits of $50 million will be .55. If the team sells players late in the season, there will be a .10 probability of high attendance with profits of $105 million, a .30 probability of mediocre attendance with profits of $65 mil- lion, and a .60 probability of low attendance with profits of $45 million.
Assist Penny and Nathan in determining the best strategy to follow and its expected value.
In: Advanced Math
----- Please solve the questions with the code below. Thank you. -----
Exercise Overview
Refactor your code to enhance the user experience and to use objects and classes.
All functional requirements in Project 1 remain, except where enhancing the system replaces specific functions.
Functional Requirements
Analysis. Describe any analysis that is required for solving the problem, including a discussion of key elements and complex statements or logic of the system.
Design. Describe the major steps for solving the problem (developing the code). A high-level outline of the classes and the variables and methods in the classes is recommended.
Testing. Describe how you tested the system.
----- Please solve the questions with the code below. Thank you. -----
import java.util.Scanner;
import java.util.concurrent.TimeUnit;
import java.time.format.DateTimeFormatter;
import java.time.LocalDateTime;
public class Question {
public static void main(String arg[]) {
String name;
Scanner sc = new
Scanner(System.in);
int num,max,min,count=0;
double num1,num2;
double ans,result;
String str ="";
System.out.print("Enter your name :
");
name = sc.nextLine();
System.out.println("Enter \"A\" for
Addition, \"S\" for Subtraction, \"M\" for Multiplication, \"D\"
for Division: M");
System.out.print("Enter : ");
char ch = sc.next().charAt(0); //
input choice for operation
System.out.print("Enter the number
of problems you wish to work : ");
num = sc.nextInt();
System.out.println("What are the
low and high numbers you want in your problems?");
System.out.print("Enter the low
value for your problems : ");
min = sc.nextInt();
System.out.print("Enter the high
value for your problems : ");
max = sc.nextInt();
long startTime = System.nanoTime();
// start session for questions
if(ch == 'A')
{
str =
"Addition";
for(int
i=0;i<num;i++)
{
num1 = (int)(Math.random() * (max - min + 1) +
min);
num2 = (int)(Math.random() * (max - min + 1) +
min);
System.out.print((int)num1 +" + "+ (int)num2 +"
= ");
ans = sc.nextDouble();
if(ans == (num1+num2))
{
count++;
System.out.println("Correct");
}
else
{
System.out.println("Incorrect");
}
}
}
else if(ch == 'S')
{
str =
"Subtraction";
for(int
i=0;i<num;i++)
{
num1 = (int)(Math.random() * (max - min + 1) +
min);
num2 = (int)(Math.random() * (max - min + 1) +
min);
System.out.print((int)num1 +" - "+ (int)num2 +"
= ");
ans = sc.nextDouble();
if(ans == (num1-num2))
{
count++;
System.out.println("Correct");
}
else
{
System.out.println("Incorrect");
}
}
}
else if(ch == 'M')
{
str =
"Multipication";
for(int
i=0;i<num;i++)
{
num1 = (int)(Math.random() * (max - min + 1) +
min);
num2 = (int)(Math.random() * (max - min + 1) +
min);
System.out.print((int)num1 +" * "+ (int)num2 +"
= ");
ans = sc.nextDouble();
if(ans == (num1*num2))
{
count++;
System.out.println("Correct");
}
else
{
System.out.println("Incorrect");
}
}
}
else if(ch == 'D')
{
str =
"Division";
for(int
i=0;i<num;i++)
{
num1 = (int)(Math.random() * (max - min + 1) +
min);
num2 = (int)(Math.random() * (max - min + 1) +
min);
System.out.print((int)num1 +" / "+ (int)num2 +"
= ");
ans = sc.nextDouble();
result = (num1/num2);
double result1 =
Math.round(result*1000.0)/1000.0;
if(ans == result1 )
{
count++;
System.out.println("Correct
"+result1);
}
else
{
System.out.println("Incorrect
"+result1);
}
}
}
else
{
System.out.println("Wrong Input !");
}
long endTime = System.nanoTime();
// sessio end for question
System.out.println("");
System.out.println("Session Summary
: ");
System.out.println(num+"
problems,"+count+" correct");
double avg =
(count*1.0/num*1.0)*100;
long totalTime = endTime -
startTime; // calculate time in nanoseconds
long seconds =
TimeUnit.NANOSECONDS.toSeconds(totalTime); // convert time
nanoseconds to seconds
System.out.println("Score is
"+(Math.round(avg)) +", Time is : "+seconds+" seconds");
DateTimeFormatter dtf =
DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss"); // date
LocalDateTime now =
LocalDateTime.now(); // local time
System.out.println("Session for
"+name+" was "+str+" on "+dtf.format(now));
}
}
In: Computer Science
QUESTION 1
The half-life for a reaction that is
first-order in A is 15 minutes. How long will it take for the
concentration of A to change from 0.16 M to 0.040
M?
A(g) → B(g) + C(g)
|
60 min |
||
|
45 min |
||
|
30 min |
||
|
23 min |
||
|
15 min |
4 points
QUESTION 2
When a 0.100 mol of a pure compound is dissolved in 1.0 L of water, the solution pH changes from 7.00 to 4.24. Which of the following is most likely the identity of the substance?
|
A strong acid |
||
|
A strong base |
||
|
A weak acid |
||
|
A weak base |
||
|
A neutral salt |
4 points
QUESTION 3
Which of the following will NOT change if the temperature of a reaction system is changed?
|
Frequency of molecular collisions |
||
|
Average kinetic energy of reactant molecules |
||
|
Reaction rate |
||
|
Rate constant |
||
|
Activation energy |
4 points
QUESTION 4
Which of the following best describes any reaction system where Q < Kc?
|
The system will never be able to reach a state of equilibrium. |
||
|
The system is at equilibrium, and there are more products than reactants at equilibrium. |
||
|
The system is at equilibrium, and there are more reactants than products at equilibrium. |
||
|
The system is not at equilibrium, and the reaction will go in the reverse direction. |
||
|
The system is not at equilibrium, and the reaction will go in the forward direction. |
4 points
QUESTION 5
What is the equilibrium constant expression for
Kc for the following heterogeneous
equilibrium?
Ni(CO)4(g)
<----> Ni(s) + 4CO(g)
4 points
QUESTION 6
Which of the following occurs when the temperature of a contained gas is reduced at constant volume?
|
Pressure decreases |
||
|
Average molecular velocity decreases |
||
|
Average kinetic energy decreases |
||
|
Collision frequency decreases |
||
|
All of these |
4 points
QUESTION 7
Given a fixed amount of an ideal gas held at constant pressure, calculate the volume it would occupy if a 2.00 L sample were cooled from 60.0°C to 30.0°C.
|
1.00 L |
||
|
4.00 L |
||
|
0.20 L |
||
|
1.82 L |
||
|
0.455 L |
4 points
QUESTION 8
Which of the following properties of liquids generally is lower for substances with stronger intermolecular forces?
|
Viscosity |
||
|
Vapor pressure |
||
|
Boiling point |
||
|
Both viscosity and vapor pressure |
||
|
All of these |
4 points
QUESTION 9
Use the initial concentration and initial rate data in the table
to determine the rate law for the reaction:
A(aq) +
B(aq) → C(aq) +
D(g)
|
Experiment # |
[A] (M) |
[B] (M) |
Initial Rate (M/s) |
|
1 |
0.400 |
0.400 |
9.00×10-3 |
|
2 |
0.200 |
0.400 |
4.50×10-3 |
|
3 |
0.200 |
0.200 |
1.13×10-3 |
|
Rate = k[A] |
||
|
Rate = k[B]2 |
||
|
Rate = k[B] |
||
|
Rate = k[A]2[B] |
||
|
Rate = k[A][B]2 |
4 points
QUESTION 10
If the hydronium ion concentration, [H3O+], in a solution is 5.6×10−10M, what is the hydroxide ion concentration, [OH−], and the pH of the solution?
|
[OH−] = 1.8×109 M, pH = 4.75 |
||
|
[OH−] = 5.6×10−10M, pH = 10.56 |
||
|
[OH−] = 1.0×10−7M, pH = 5.60 |
||
|
[OH−] = 4.4×10−4M, pH = 9.25 |
||
|
[OH−] = 1.8×10−5M, pH = 9.25 |
4 points
QUESTION 11
Which of the following gases has the lowest average molecular velocity at the same temperature?
|
Ne |
||
|
Xe |
||
|
N2 |
||
|
F2 |
||
|
All of these have the same average molecular velocity. |
4 points
QUESTION 12
In the following 2-step mechanism, which is the
catalyst?
Step 1: A + B → C + D
Step 2: B + C → X +
A
|
A |
||
|
B |
||
|
C |
||
|
D |
||
|
X |
4 points
QUESTION 13
Which of the following substances has hydrogen bonding when in the pure liquid state?
|
CH3-O-CH3 |
||
|
NF3 |
||
|
CH3OH |
||
|
HBr |
||
|
All of these have hydrogen bonding in the pure liquid state. |
4 points
QUESTION 14
Consider the following endothermic reaction at equilibrium in a
1-liter container:
2Cl2(g)
+ 2H2O(g)
<----> 4HCl(g) +
O2(g)
ΔH
> 0
Which of the following will cause a decrease in
the equilibrium concentration of O2?
|
Increasing the temperature |
||
|
Adding Cl2 gas |
||
|
Adding HCl gas |
||
|
Adding O2 |
||
|
Increasing the volume of the container |
4 points
QUESTION 15
Consider the following exothermic reaction at a state of equilibrium: C(s) + O2(g) <----> CO2(g) . Which of the following changes will cause value of the equilibrium constant Kc to change?
|
Increasing the container volume |
||
|
Increasing the temperature |
||
|
Removing O2 |
||
|
Adding solid carbon |
||
|
All of these |
4 points
QUESTION 16
Which of the following increases the solubility of a gas in solution?
|
Increasing gas pressure and increasing temperature |
||
|
Increasing gas pressure and decreasing temperature |
||
|
Decreasing gas pressure and increasing temperature |
||
|
Decreasing gas pressure and decreasing temperature |
||
|
Adding more water |
4 points
QUESTION 17
When comparing a 1 m NaCl solution to that of pure water:
|
The 1 m NaCl solution has a higher boiling point and the higher freezing point. |
||
|
The 1 m NaCl solution has a higher boiling point and a lower freezing point. |
||
|
The 1 m NaCl solution has a lower boiling point and a higher freezing point. |
||
|
The 1 m NaCl solution has a lower boiling point and a lower freezing point. |
||
|
They both have the same boiling point and freezing point. |
4 points
QUESTION 18
Which of the following types of solids have relatively low melting points, because melting these solids requires breaking intermolecular forces, not real bonds?
|
Molecular solids |
||
|
Ionic solids |
||
|
Covalent-network solids |
||
|
Metallic solids |
||
|
Semiconductors |
4 points
QUESTION 19
Which of the following does NOT describe semiconductors?
|
Their band gaps are between metals and insulators. |
||
|
Doped p-type and n-type semiconductors are less conductive than semiconductor materials that are not doped. |
||
|
Their band gaps increase as particle size decreases in the 1-10 nm range. |
||
|
They can be a single element or a compound. |
||
|
They usually have an average number of 4 valence electrons per atom. |
4 points
QUESTION 20
If the average rate of appearance of NH3 in the
following reaction is 1.40 M/s, what is the average rate
of disappearance of H2 during the same time
period?
N2(g)
+
3H2(g) →
2NH3(g)
|
5.40 M/s |
||
|
2.80 M/s |
||
|
1.20 M/s |
||
|
0.700 M/s |
||
|
2.10 M/s |
4 points
QUESTION 21
Which of the following should be the most soluble in benzene, C6H6?
|
CH3OH |
||
|
H2O2 |
||
|
CCl4 |
||
|
HF |
||
|
CH3NH2 |
4 points
QUESTION 22
Which of the following best explains the relative boiling points for Cl2 and HCl?
|
Cl2 has the higher boiling point because liquid
Cl2 has stronger London-dispersion forces than liquid
HCl. |
||
|
Cl2 has the higher boiling point because liquid
Cl2 has stronger dipole-dipole forces than liquid
HCl. |
||
|
HCl has the higher boiling point because liquid HCl has
hydrogen-bonding interactions while liquid Cl2 |
||
|
HCl has the higher boiling point because liquid HCl has dipole-dipole forces while liquid Cl2 does not have dipole-dipole forces. |
4 points
QUESTION 23
What is the density (g/L) of H2 gas at a temperature of 283 K and 0.500 atm? (Hint: One approach is to assume a sample size of 1.0 L.)
|
0.0107 g/L |
||
|
0.0217 g/L |
||
|
0.0434 g/L |
||
|
93.7 g/L |
||
|
0.0899 g/L |
4 points
QUESTION 24
Given that the molar volume of Ne gas is 22.414 L/mol at STP
(1.00 atm of pressure and at a temperature of 273.15 K), predict
the volume of H2
gas when the number of moles is 2.50 mol under the same conditions
of temperature and pressure.
|
2.24 L |
||
|
56.0 L |
||
|
0.110 L |
||
|
5.60 L |
||
|
11.1 L |
4 points
QUESTION 25
Which of the following best describes a chemical reaction in a state of equilibrium?
|
Reactant molecules are forming products as fast as product molecules are reacting to form reactants. |
||
|
The rate constants of the forward and reverse reactions (kf and kr) are equal. |
||
|
The value of the equilibrium constant, Kc, is 1. |
||
|
The limiting reagent has been consumed. |
||
|
All chemical reactions have stopped. |
In: Chemistry