Write a Python program that can compare the unit (perlb) cost of sugar sold in packages with different weights and prices. The program prompts the user to enter the weight and price of package 1, then does the same for package 2, and displays the results to indicate sugar in which package has a better price. It is assumed that the weight of all packages is measured in lb. The program should check to be sure that both the inputs of weight and price are both positive values.

Answers

Answer 1

Answer:

This program is written using python

It uses less comments (See explanation section for more explanation)

Also, see attachments for proper view of the source code

Program starts here

#Prompt user for price of package 1

price1 = int(input("Enter Price 1: "))

while(price1 <= 0):

     price1 = int(input("Enter Price 1: "))

#Prompt user for weight of package 1

weight1 = int(input("Enter Weight 1: "))

while(weight1 <= 0):

     weight1 = int(input("Enter Weight 1: "))

#Calculate Unit of Package 1

unit1 = float(price1/weight1)

print("Unit cost of Package 1: "+str(unit1))

#Prompt user for price of package 2

price2 = int(input("Enter Price 2: "))

while(price2 <= 0):

     price2 = int(input("Enter Price 2: "))

#Prompt user for weight of package 2

weight2 = int(input("Enter Weight 2: "))

while(weight2 <= 0):

     weight2 = int(input("Enter Weight 2: "))

#Calculate Unit of Package 2

unit2 = float(price2/weight2)

print("Unit cost of Package 2: "+str(unit2))

#Compare units

if unit1 > unit2:

     print("Package 1 has a better price")

elif unit1 == unit2:

     print("Both Packages have the same price")

else:

     print("Package 2 has a better price")

Explanation:

price1 = int(input("Enter Price 1: ")) -> This line prompts the user for price of package 1

The following while statement is executed until user inputs a value greater than 1 for price

while(price1 <= 0):

     price1 = int(input("Enter Price 1: "))

weight1 = int(input("Enter Weight 1: ")) -> This line prompts the user for weight of package 1

The following while statement is executed until user inputs a value greater than 1 for weight

while(weight1 <= 0):

     weight1 = int(input("Enter Weight 1: "))

unit1 = float(price1/weight1) -> This line calculates the unit cost (per weight) of package 1

print("Unit cost of Package 1: "+str(unit1)) -> The unit cost of package 1 is printed using this print statement

price2 = int(input("Enter Price 2: ")) -> This line prompts the user for price of package 2

The following while statement is executed until user inputs a value greater than 1 for price

while(price2 <= 0):

     price2 = int(input("Enter Price 2: "))

weight2 = int(input("Enter Weight 2: ")) -> This line prompts the user for weight of package 2

The following while statement is executed until user inputs a value greater than 1 for weight

while(weight2 <= 0):

     weight2 = int(input("Enter Weight 2: "))

unit2 = float(price2/weight) -> This line calculates the unit cost (per weight) of package 2

print("Unit cost of Package 2: "+str(unit2)) -> The unit cost of package 2 is printed using this print statement

The following if statements compares and prints which package has a better unit cost

If unit cost of package 1 is greater than that of package 2, then package 1 has a better priceIf unit cost of both packages are equal then they both have the same priceIf unit cost of package 2 is greater than that of package 1, then package 2 has a better price

if unit1 > unit2:

     print("Package 1 has a better price")

elif unit1 == unit2:

     print("Both Packages have the same price")

else:

     print("Package 2 has a better price")

Write A Python Program That Can Compare The Unit (perlb) Cost Of Sugar Sold In Packages With Different
Write A Python Program That Can Compare The Unit (perlb) Cost Of Sugar Sold In Packages With Different

Related Questions

A/an ____ file saves a workbook as a comma-delimited text file for use on another windows operating system??

A. XPS
B. TXT
C. ODS
D. CVS

Answers

Answer:

The correct option is D

D) CVS

Explanation:

A CVS file saves a workbook as a comma-delimited text file for use on another windows operating system. It ensures that line breaks, tab characters and other characteristics are interpreted correctly.

A CVS file stands for Comma Separated Value file, which basically allows the data to be saved in tabular format. However they differ from other spreadsheet file types because you can only have a single sheet in a file. Moreover, you cannot save cell, column or row in it.

CASE II AziTech is considering the design of a new CPU for its new model of computer systems for 2021. It is considering choosing between two (2) CPU (CPUA and CPUB) implementations based on their performance. Both CPU are expected to have the same instruction set architecture. CPUA has a clock cycle time of 60 ns and CPUB has a clock cycle time of 75 ns. The same number of a particular instruction type is expected to be executed on both CPUs in order to determine which CPU would executes more instructions. CPUA is able to execute 2MB of instructions in 5*106 clock cycles. CPUB executes the same number of instructions in 3*106 clock cycles. a) Using the MIPS performance metric, which of the two (2) CPU should be selected to be implemented in the new computer system. Justify your choice. b) Compute the execution time for both CPUs. Which CPU is faster?

Answers

Answer:

(a)The CPU B should be  selected for the new computer as it has a low clock cycle time which implies that it will implement the process or quicker when compared to the CPU A.

(b) The CPU B is faster because it executes the same number of instruction in a lesser time than the CPU A .

Explanation:

Solution

(a)With regards to  the MIPS performance metric the CPU B should be chosen for the new computer as it low clock cycle time which implies that it will implement the process or quicker when compared to the CPU A and when we look at the amount of process done by the system , the CPU B is faster when compared to other CPU and carries out same number of instruction in time.

The metric of response time for CPU B is lower than the CPU A and it has advantage over the other CPU and it has better amount as compared to CPU A, as CPU B is carrying out more execution is particular amount of time.

(b) The execution can be computed as follows:

Clock cycles taken for a program to finish * increased by the clock cycle time = the Clock cycles for a program * Clock cycle time

Thus

CPU A= 5*10^6 * 60*10^-9 →300*10^-3 →0.3 second (1 nano seconds =10^-9 second)

CPU B= 3 *10^6 * 75*10^-9 → 225*10^-3 → 0.225 second

Therefore,The CPU B is faster as it is executing the same number of instruction in a lesser time than the CPU A

Let K(x, y) denote the statement "x knows y" and D denote the domain of all people. Express the following English sentences as a quantified proposition using the definitions above:

1. Everybody knows somebody.
2. There is somebody that no one knows.
3. There is no one who knows everybody

Answers

Answer:

Given: K(x,y) denotes statement:

"x knows y"

D denote domain of all people.

Explanation:

1. Everybody knows somebody.

Solution:

∀x∈D ∃y∈D : K(x, y)

∀ means for all. Here it is used for Everybody.

∃ means there exists some. Here it represents Somebody.

∈ means belongs to . Both x and y belongs to the domain D of all people.

2. There is somebody that no one knows.

Solution:

∀x∈D ∃y∈D : ¬K(x, y)

∀ means for all. ∃ means there exists some. ∈ means belongs to both x and y belongs to the domain D of all people.¬ this is negation sign which means not K(x,y). So the negation of everybody knows somebody can be expressed as there is somebody that no one knows.

3. There is no one who knows everybody

Solution:

This can be represented in both the ways below.

∀ y∈D ∃ x∈D : K(x, y)

∀ means for all. ∃ means there exists some. ∈ means belongs to both x and y belongs to the domain D of all people.

∀x∈D ∀y∈D : ¬K(x, y)

∀ means for all. The negation shows that there is no one who knows everybody.

A number of LC-3 instructions have an "evaluate address" step in the instruction cycle, in which a 16-bit address is constructed and written to the Memory Address Register via the MARMUX. List all LC-3 instructions that write to the MAR during the evaluate address phase of the instruction cycle, with the Register Transfer description of each.

Answers

Answer: you want to list all LC structers

Explanation:

Complete main() to read dates from input, one date per line. Each date's format must be as follows: March 1, 1990. Any date not following that format is incorrect and should be ignored. Use the substring() method to parse the string and extract the date. The input ends with -1 on a line alone. Output each correct date as: 3/1/1990.
Ex: If the input is:
March 1, 1990
April 2 1995
7/15/20
December 13, 2003
-1
then the output is:
3/1/1990
12/13/2003
Given Code:
import java.util.Scanner;
public class DateParser {
public static int getMonthAsInt(String monthString) {
int monthInt;
// Java switch/case statement
switch (monthString) {
case "January":
monthInt = 01;
break;
case "February":
monthInt = 02;
break;
case "March":
monthInt = 03;
break;
case "April":
monthInt = 04;
break;
case "May":
monthInt = 05;
break;
case "June":
monthInt = 06;
break;
case "July":
monthInt = 07;
break;
case "August":
monthInt = 8;
break;
case "September":
monthInt = 9;
break;
case "October":
monthInt = 10;
break;
case "November":
monthInt = 11;
break;
case "December":
monthInt = 12;
break;
default:
monthInt = 00;
}
return monthInt;
}
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
// TODO: Read dates from input, parse the dates to find the one
// in the correct format, and output in mm/dd/yyyy format

}
}

Answers

Using the knowledge in computational language in C++ it is possible to write a code that complete main() to read dates from input, one date per line

Writting the code:

#include <iostream>

#include <string>

using namespace std;

int DateParser(string month) {

  int monthInt = 0;

 

  if (month == "January")

      monthInt = 1;

  else if (month == "February")

      monthInt = 2;

  else if (month == "March")

      monthInt = 3;

  else if (month == "April")

      monthInt = 4;

  else if (month == "May")

      monthInt = 5;

  else if (month == "June")

      monthInt = 6;

  else if (month == "July")

      monthInt = 7;

  else if (month == "August")

      monthInt = 8;

  else if (month == "September")

      monthInt = 9;

  else if (month == "October")

      monthInt = 10;

  else if (month == "November")

      monthInt = 11;

  else if (month == "December")

      monthInt = 12;

  return monthInt;

}

int main ()

{

 

  // TODO: Read dates from input, parse the dates to find the one

  // in the correct format, and output in m/d/yyyy format

  while(1)

  {

   //declaring the required variables

  int monthInt,dayInt,yearInt;string input;

  //receive the input string frim the user

  getline(cin,input);

  //if the input is -1 then quit

  if(input=="-1")

    break;

  //else try to process the input

  try

  {

  //find and extract the month name and parse it to monthInt

  monthInt=DateParser(input.substr(0,input.find(' ')));

  //find and extract the day and parse it to dayInt

  dayInt=stoi(input.substr(input.find(' '),input.find(", ")));

  //find and extract the year and parse it to yearInt

  yearInt=stoi(input.substr(input.find(", ")+1,input.length()));

  //display the output

  cout<<monthInt<<"/"<<dayInt<<"/"<<yearInt<<endl;

  }

  //catch if any of the exceptions happens

  catch(exception& e){}

  }

}

See more about C++ at brainly.com/question/19705654

#SPJ1

Write Python code to save the data to a MongoDB collection:Import json module to parse JSON dataImport MongoClient from pymongo to use MongoDBCreate a loop to iterate through the variable with data from Twitter, and for each tweet:Parse these related values: id, text, created_at, user’s screen_name, retweet_count, favorite_count, lang.Use MongoDB’s insert method to add the parsed tweet values to MongoDB collection;Write Python code to query the database:Use find method to search for tweets with lang="en";Use the aggregate method with $sum to compute the total retweets;Use the aggregate method with $count and $group to count the number of tweets by each user (screen_name);

Answers

Answer:

Explanation:

The objective of this task is to compute a program that involves the usage of Python code to save the data to MongoDB and to query  the database.

Due to the error that occur which makes me to be unable to submit this answer, I've created a word document instead and the attached file can be found below.

Thanks!

In which situations would it be most helpful to filter a form? Check all that apply.

Answers

Filtering is a useful way to see only the data that you want displayed in Access databases.

An assault on system security that derives from an intelligent act that is a deliberate attempt to evade security services and violate the security policy of a system is a(n) _________.
A. Risk
B. Attack
C. Asset
D. Vulnerability

Answers

Answer:

Option B: Attack

Explanation:

A security attack is an act to access to a system without a legit authorization. Usually the aim is to steal confidential info from the system or control the system by manipulating the data stored in the system. Some attacks are also aimed to disable the operation of the hacked system. Nowadays, there are several common types of security attacks which include

phishingransomwaredenial of servicemain in the middleSQL injectionmalware

For this project, you have to write 3 functions. C++

1. remove_adjacent_digits. This takes in 2 arguments, a std::vector, and a std::vector of the same size. You need to return a std::vector, where each of the strings no longer has any digits that are equal to, one more, or one less, than the corresponding integer in the 2nd vector.

2. sort_by_internal_numbers. This takes in a single argument, a std::vector, and you need to return a std::vector, which is sorted as if only the digits of each string is used to make a number.

3. sort_by_length_2nd_last_digit. This takes in a std::vector>. It returns a vector of the same type as the input, which is sorted, first by the length of the string in the pair, and if they are the same length, then the second last digit of the int.

See the test cases for examples of each of the above functions.

You need to submit a single file called main.cpp that contains all these functions. You can (and should) write additional functions as well. There is no need for a main function.

No loops (for, while, etc) are allowed. You must use only STL algorithms for this project.

Answers

Find the given attachments

For this assignment, you will create flowchart using Flowgorithm and Pseudocode for the following program example:
Hunter Cell Phone Company charges customer's a basic rate of $5 per month to send text messages. Additional rates apply as such:
The first 60 messages per month are included in the basic bill
An additional 10 cents is charged for each text message after the 60th message and up to 200 messages.
An additional 25 cents is charged for each text after the 200th message
Federal, state, and local taxes add a total of 12% to each billThe company wants a program that will accept customer's name and the number of text messages sent. The program should display the customer's name and the total end of the month bill before and after taxes are added.

Answers

Answer:

The pseudocode is as given below in the explanation while the flow diagram is attached herewith

Explanation:

The pseudocode is as follows

input cust_name, num_texts  

Set Main_bill=5 $;

if the num_texts is less than or equal to 60

Excess_Charge=0;

If the num_texts is greater than 60 and less than or equal to 200

num_text60200 =num_texts-60;

Excess_Charge=0.1*(num_text60200);

else If the num_texts is greater than 60

num_texts200 =num_texts-200;

Excess_Charge=0.25*(num_texts200)+0.1*(200-60);

Display cust_Name

Total_Bill=Main_bill+Excess_Charge;

Total_Bill_after_Tax=Total_Bill*1.12;

Chapter 15 Problem 6 PREVENTIVE CONTROLS Listed here are five scenarios. For each scenario, discuss the possible damages that can occur. Suggest a pre-ventive control. a. An intruder taps into a telecommunications device and retrieves the identifying codes and personal identification numbers for ATM cardholders. ( The user subsequently codes this information onto a magnetic coding device and places this strip on a piece of cardboard.) b. Because of occasional noise on a transmission line, electronic messages received are extremely garbled. c. Because of occasional noise on a transmission line, data being transferred is lost or garbled. d. An intruder is temporarily delaying important strategic messages over the telecommunications lines. e. An intruder is altering electronic messages before the user receives them.

Answers

Answer: seen below

Explanation:

There are various solution or ways to go about this actually. In the end, curtailing this is what matters in the end.

Below i have briefly highlighted a few precise way some of this problems can be solved, other options are open for deliberation.

A. Digital encoding of information with the calculation being changed occasionally, particularly after the frameworks advisors have finished their employments, and the framework is being used.

Which can also mean; The money could be withdrawn form the ATM. preventive Control is password to be changed periodically and regularly.

B. Noise on the line might be causing line blunders, which can bring about information misfortune. Reverberation checks and equality checks can assist with recognizing and right such mistakes.

C. If information is being lost, reverberation checks and equality checks ought to likewise help; notwithstanding, the issue might be that an intruder is blocking messages and altering them. Message arrangement numbering will assist with deciding whether messages are being lost, and in the event that they are maybe a solicitation reaction strategy ought to be executed that makes it hard for gatecrashers to dodge.

D. In the event that messages are being postponed, a significant client request or other data could be missed. As in thing c, message arrangement numbering and solicitation reaction methods ought to be utilized.

E. Messages modified by intruders can have an extremely negative effect on client provider relations if orders are being changed. For this situation, information encryption is important to keep the gatecrasher from perusing and changing the information. Additionally, a message succession numbering strategy is important to ensure the message isn't erased.

cheers i hope this was helpful !!

Charles Montesquieu believed that the
Legislative Branch should do what?
A. Make laws
B. Enforce laws
C. Interpret laws
elles sone. All Rights Resed.​

Answers

Answer:

A. Make Laws

Explanation:

Montesquieu believed the ways to go about limiting the power of a monarch would be to split up power among 3 groups, Judicial, Legislative and Executive. The American Presidential system and Constitution used Montesquieu's writings as a foundation for their principles.

Judicial Interprets lawsLegislative Makes lawsExecutive Enforces Law

A. make laws ........ sorry for all the dots have to make it longer :/

Pretend that your mother is a real estate agent and that she has decided to automate her daily tasks by using a laptop computer. Consider her potential hardware and software needs and create a hardware and software specification that describes them. The specification should be developed to help your mother buy her hardware and software on her own.

Answers

TJ life was the way to get

The specification should be developed to help your mother buy her hardware and software on her own is hardware.

Which is hardware?

Hardware refers back to the computer's tangible additives or shipping structures that shop and run the written commands furnished through the software program. The software program is the intangible a part of the tool that shall we the consumer have interaction with the hardware and command it to carry out unique tasks.

A few automatic software programs could ship messages, alert and notifications to the customer in addition to the owner.The pc need to be of respectable potential and processing pace three. Video calling software program to have interaction with the clients. Softwares like Excel to keep the information and all An running gadget of right here convenience 4.320 to 500 GB difficult drive three.2.2 GHz of processor. Long battery life Software: three GB RAM.

Read more about the hardware :

https://brainly.com/question/3273029

#SPJ2

Managers can use __ software to discuss financial performance with the help of slides and charts

Answers

Answer:

presentation

Explanation:

Software like Google Slides and Microsoft Powerpoint can be utilized to present financial performances through the use of slides and charts.

random integer between 3 and 13 (inclusive)

Answers

Answer:

6

Explanation:

Answer:

4

Explanation:

It is between 3 and 13. Please answer some of my questions too! :)

Write a program that accepts any number of homework scores ranging in value from 0 through 10. Prompt the user for a new value if they enter an alphabetic character. Store the values in array. Calculate the average excluding the lowest and highest scores. Display the average as well as the highest and lowest score that were discarded.

Answers

Answer:

This program is written in C++

Note that the average is calculated without the highest and the least value.

Comments are used for explanatory purpose

See attachment for .cpp file.

Program starts here

#include<iostream>

using namespace std;

int main()

{

int num;

cout<<"Enter Number of Test [0-10]: ";

//cin>>num;

while(!(cin>>num) || num > 10|| num<0)

{

cout << "That was invalid. Enter a valid digit: "<<endl;

cin.clear(); // reset the failed input

cin.ignore(123,'\n');//Discard previous input

}

//Declare scores

int scores[num];

//Accept Input

for(int i =0;i<num;i++)

{

cout<<"Enter Test Score "<<(i+1)<<": ";

cin>>scores[i];

}

           //Determine highest

           int max = scores[0];

           for (int i = 1; i < num; i++)

           {

               if (scores[i] > max)

               {

                   max = scores[i];

               }

           }

           //Determine Lowest

           int least = scores[0];

           for (int i = 1; i < num; i++)

           {

               if (scores[i] < least)

               {

                   least = scores[i];

               }

           }

           int sum = 0;

           //Calculate total

           for(int i =0; i< num;i++)

           {

               sum += scores[i];

           }

           //Subtract highest and least values

           sum = sum - least - max;

           //Calculate average

           double average = sum / (num - 2);

           //Print Average

           cout<<"Average = "<<average<<endl;

           //Print Highest

           cout<<"Highest = "<<max<<endl;

           //Print Lowest

           cout<<"Lowest = "<<least;

return 0;  

}

Convert each of the following for loops into an equivalent while loop. (You might need to rename some variables for the code to compile, since all four parts a-d are in the same scope.)

// a.

System.out.println("a.");
int max = 5;
for (int n = 1; n <= max; n++) {

System.out.println(n);

}

System.out.println();

// b.

System.out.println("b.");

int total = 25;

for (int number = 1; number <= (total / 2); number++) {

total = total - number;

System.out.println(total + " " + number);

}

System.out.println();

// c.

System.out.println("c.");

for (int i = 1; i <= 2; i++) {

for (int j = 1; j <= 3; j++) {

for (int k = 1; k <= 4; k++) {

System.out.print("*");

}

System.out.print("!");

}

System.out.println();

}

System.out.println();

// d.

System.out.println("d.");

int number = 4;

for (int count = 1; count <= number; count++) {

System.out.println(number);

number = number / 2;

}

Answers

Answer:

~CaptnCoderYankee

Don't forget to award brainlyest if I got it right!

You are working at the Acme company that has the following environment: 400 Windows Servers 2. 8000 Windows client devices (laptops running Windows os) 40 Linux servers Active Directory Domain Services to provide dns services to all the hosts, both Windows and Linux. Acme acquires a small research company, Uni-Tech that uses Unix servers for all of its applications. For host resolution they use BIND
a. Describe what BIND is and what the acronym stands for? BIND stands for Berkley Internet Name Domain. BIND allows you to pick one of your computers to act as the DNS server.
b. This acquisition happens very quickly and on day one the business needs people at Uni-Tech to connect to hosts at Acme using hosts names that can be resolved by Active Directory. Describe a method for integrating the two environments that does not require too many individual tasks that will take many hours. (10) Describe how you would test to make sure your integration is working correctly.

Answers

Answer: Provided in the explanation section

Explanation:

(a). BIND is a type of DNS server used on the internet, actually it is reported to be most widely used DNS server on the internet. Also BIND is the de-facto standard on Unix like operating systems and Linux. Thus it can be used to locate computers on a network using domain names instead of their IP addresses. BIND was originally programmed at the University of California, Berkeley in the 1980s, this was made possible by a grant from US based DARPA program.

Originally, BIND stood for Berkeley Internet name daemon, but nowadays it is called Berkeley Internet name domain.

(b). In some of the clients in windows and Windows servers we will install LDP. By the LDP.exe we can test tDNS, Active directory woking , even we can add or modify. LDP is used to test and verify the Active Directory objects. We will install in windows machine then open the software, then from the menu we will select connect and type the IP adress of the Active Directory then we will select or type the objects of Active directory. For Linux system we have to openldap and can search the AD.

From Linux or Unix we can use the nmap tool which can test the network connectivity between all the computers whether it is windows or Linux. By nmap we can test by ICMP protocol to verify the network connectivity. By nmap we can scan all the port which are required to open from client to the server. We can also use nslookup to test DNS server from the client. By nslookup we can check that client can connect the server.

Consider the following skeletal C-like program:
void fun1(void); /* prototype */
void fun2(void); /* prototype */
void fun3(void); /* prototype */
void main() {
int a, b, c;
. . .
}
void fun1(void) {
int b, c, d;
. . .
}
void fun2(void) {
int c, d, e;
. . .
}
void fun3(void) {
int d, e, f;
. . .
}
Given the following calling sequences and assuming that dynamic scoping is used, what variables are visible during execution of the last function called? Include with each visible variable the name of the function in which it was defined
a. main calls funl; funl calls fun2; fun2 calls fun3
b. main calls fun1; fun1 calls fun3
c. main calls fun2; fun2 calls fun3; fun3 calls funl
d. main calls fun1; funl calls fun3; fun3 calls fun2.

Answers

Answer:

In dynamic scoping the current block is searched by the compiler and then all calling functions consecutively e.g. if a function a() calls a separately defined function b() then b() does have access to the local variables of a(). The visible variables with the name of the function in which it was defined are given below.

Explanation:

a. main calls fun1; fun1 calls fun2; fun2 calls fun3

Solution:

Visible Variable:  d, e, f         Defined in: fun3Visible Variable: c                  Defined in: fun2 ( the variables d and e of fun2 are not visible)Visible Variable: b                  Defined in: fun1 ( c and d of func1 are hidden)Visible Variable: a                  Defined in: main (b,c are hidden)

b. main calls fun1; fun1 calls fun3

Solution:

Visible Variable:  d, e, f          Defined in: fun3 Visible Variable:  b, c              Defined in: fun1 (d not visible)Visible Variable:  a                 Defined in: main ( b and c not visible)

c. main calls fun2; fun2 calls fun3; fun3 calls fun1

Solution:

Visible Variable:  b, c, d         Defined in: fun1 Visible Variable:  e, f              Defined in: fun3 ( d not visible)Visible Variable:  a                 Defined in: main ( b and c not visible)

Here variables c, d and e of fun2 are not visible .

d. main calls fun1; fun1 calls fun3; fun3 calls fun2

Solution:

Visible Variable: c, d, e        Defined in: fun2Visible Variable:  f                Defined in: fun3 ( d and e not visible)Visible Variable:  b              Defined in: fun1 ( c and d not visible)Visible Variable: a                Defined in: main ( b and c not visible)

Write a program that reads in investment amount, annual interest rate, and number of years, and displays the future investment value using the following formula: futureInvestmentValue = investmentAmount * (1 + monthyInterestRate)numberOfYears*12. For example if you enter amount 1000, annual interest rate 3.25%, and number of years 1, the future investment value is 1032.98.NB: Please make sure to use the NumberFormat coding for currency to display your results. (Java Programming)

Answers

Answer:

Following are the code to this question:

import java.util.*; //importing package for user input

public class Main //defining class

{

public static void main(String []ar) //defining main method

{

double investment_amount,interest_rate,future_investment_value; //defining double variables

int years; //defining integer variable

Scanner obx=new Scanner(System.in); //creating Scanner class Object

System.out.print("Enter invest value: "); //print message

investment_amount=obx.nextDouble(); //input value

System.out.print("Enter interest rate: ");//print message

interest_rate=obx.nextDouble();//input value

System.out.print("Enter number of years: ");//print message

years=obx.nextInt();//input value

future_investment_value=investment_amount*Math.pow((1+interest_rate/1200.),years*12); //calculating value by apply formula

System.out.println("you enter amount: $"+investment_amount); //print calculated value

System.out.println("annual interest rate:"+interest_rate+"%");//print calculated value

System.out.printf("Number of years: "+years+" the future investment value is :$%.2f\n",future_investment_value);//print calculated value

}

}

output:

please find the attachment.

Explanation:

Program Description:

In the above-given program, inside the main method, a variable is declared that are investment_amount, interest_rate, future_investment_value, and years, in which only year variable is an integer type and other variables are double types.In the next step, a scanner class object that is "obx" is created, which is used to input value from the user end, in the next line we apply the formula to calculate the future_investment_value.At the last step, we all the input and a calculated value    

Using MARS/MIPS
A) Write a program which increments from 0 to 15 and display results in Decimal on the console
B) Modify above program to increment from 0 to 15 and display results in Hexadecimal on the console

Answers

Answer:

Explanation:

MIPS program which increments from 0 to 15 and display results in Decimal on the console

In this program the user defined procedures print_int and print_eot were used to print the integer values and new line characters(\n) respectively.the mechanisam of the loop is explaine in the comment section of the program.

     addi $s0, $0, 0

     addi $s1, $0, 15

print_int:

              li $v0, 1                # system call to print integer

              syscall                

              jr $ra                     # return

print_eol:                      # prints "\n"

            li $v0, 4            

              la $a0, linebrk      

              syscall              

              jr $ra                  # return

main: . . .          

              li $a0, 0                # print 0

              jal print_int         # print value in $a0

loop:   move $a0, $s0           # print loop count

       jal print_int        

       jal print_eol           # print "\n" character

       addi $s0, $s0, 1        # increment loop count by 1

       ble $s1, $s0, loop      # exit if $s1<$s0

beq $s0, $0, end

end:

MIPS progam to increment from 0 to 15 and display results in Hexadecimal on the console

this program is slightly differed from the previous program in this program the system call issued in print_int is implemented with a system call that prints numbers in hex.

addi $s0, $0, 15

     addi $s1, $0, 0

print_int:

   li      $v0,34                  # syscall number for "print hex"

   syscall                         # issue the syscall

              jr $ra                     # return

print_eol:                      # prints "\n"

            li $v0, 4            

              la $a0, linebrk      

              syscall              

              jr $ra                  # return

main: . . .          

              li $a0, 0                # print 0

              jal print_int         # print value in $a0

loop:   move $a0, $s0           # print loop count

       jal print_int        

       jal print_eol           # print "\n" character

       addi $s0, $s0, 1        # increment loop count by 1

       ble $s1, $s0, loop      # exit if $s0>$s1

beq $s0, $0, end

end:

Array A is not a heap. Clearly explain why does above tree not a heap? b) Using build heap procedure discussed in the class, construct the heap data structure from the array A above. Represent your heap in the array A as well as using a binary tree. Clearly show all the steps c) Show how heap sort work in the heap you have constructed in part (b) above. Clearly show all the step in the heap sort

Answers

Answer:

Sorted Array A { } = { 1, 4, 23, 32, 34, 34, 67, 78, 89, 100 }

Explanation:

Binary tree is drawn given that the binary tree do not follow both minimum heap and maximum heap property, therefore, it is not a heap.

See attached picture.

Three examples of parameter-parsing implementation models are: (1)________, (2)________, and (3)________.

Answers

Answer:1) Parse-by-value

2) Parse-by-reference

3) Parse-by-name

Explanation: Parameter parsing refers to a communication among procedures or functions.

The values of a variable procedure are transferred to the called procedure by some mechanisms. Different techniques of parameter-parsing include; parse-by-value, parse-by-reference, parse-by-copy restore, parse-by-name.

Your computer is once again out of hard drive and you want to see which folders are consuming the most space on your drive. Which application below will do this? A. CClreaner B. Treesize C MalwareBytes D. Auslogics Disk Defrag

Answers

Answer:

I would say cclrearner

Explanation:

This is what helped me with my computer so it may help you but try which one works for you

public class Student {
private String getFood() {
return "Pizza";
}
public String getInfo() {
return this.getFood();
}
}
public class GradStudent extends Student {
private String getFood() {
return "Taco";
}
public void teach(){
System.out.println("Education!");
getInfo();
}
}
What is the output from this:

Student s1 = new GradStudent();
s1.teach();
Education! would be printed, followed by a run-time error when getInfo is called.

Education! Pizza

This code won't run because it won't compile.

Education! Taco

This code causes a run-time error because getInfo is not declared in the GradStudent class.

Answers

Answer:

getInfo(); ==

getSy.Info()

Explanation:

Get System Info

WRITTEN INTERVIEW QUESTIONS
Doctoral candidates should provide an authentic personal statement to each of the five following questions/prompts reflecting on their own personal interest. In the event that any outside resources are used, resources should be cited in APA format. Submissions should be a maximum of 500 words or 125 words per question/prompt. It is best to response to each prompt/question individually for clarity of the reviewer. Writing sample should be submitted in Microsoft Word format and include candidate’s name.
PhD IT
1. Tell us about yourself and your personal journey that has lead you to University of the Cumberlands.
2. What are your research interests in the area of information technology? How did you become interested in this area of research?
3. What is your current job/career and how will this program impact your career growth?
4. What unique qualities do you think you have that will help you in being successful in this program?
5. How can obtaining a doctorate impact your contribution to the practices of information technology? Where do you see yourself after obtaining a doctorate from UC?

Answers

Explanation:

1. I grew up in a small community and my family owned a small business which involved manual labor. Although, having little income, my Dad sought to give us the best education he could afford from his little savings. With the small family savings I went to college where I studied Information Technology, after graduating I worked for a startup firm for two years before I decided to proceed with post graduate studies and I attained my Masters in UA. I met a friend who recommended I study in University of Cumberlands, I hesitated initially but was convinced after I researched the institution.

2. I'm particularly interested in the applications of information technology in labor intensive businesses and work because of my family background.

3. I have my own startup firm that designs work communication software for companies, however I intend to broaden my knowledge through this program into Information Technology based systems using machine learning algorithm.

4. I am committed to work and study, as some have called me a curious mind because of my passion towards learning.

5. I view obtaining a doctorate as not just a personal achievement but of lasting benefits to society as I use knowledge derived to improve the work experience of society.

I am confident that after my program I would be one the renowned contributors to the applications of information technology in labor intensive businesses.

A(n) ________ is a server-based operating system oriented to computer networking and may include directory services, network management, network monitoring, network policies, user group management, network security, and other network-related functions.

Answers

Answer:

Network Operating System (NOS)

Explanation:

A network operating system (NOS) is an operating system that makes different computer devices connect to a common network in order to communicate and share resources with each other using a server. A network operating system can be used by printers, computers, file sever among others, and they are connected together using a local area network. This local area network which they are connected to works as the server.

The NOS also acts as a network security because it could be used as an access control or even user authentication.

There are two types of NOS

1) Peer to peer network operating system.

2) Client/server network operating system

A network operating system (NOS) is a server-based operating system oriented to computer networking and may include directory services, network management, network monitoring, network policies, user group management, network security, and other network-related functions.

Python high school assignment: please keep simpleIn pythonInstructionsUse the following initializer list:w = ["Algorithm", "Logic", "Filter", "Software", "Network", "Parameters", "Analyze", "Algorithm", "Functionality", "Viruses"]Write a loop that prints the words in uppercase letters.Sample RunALGORITHMLOGICFILTERSOFTWARENETWORKPARAMETERSANALYZEALGORITHMFUNCTIONALITYVIRUSES

Answers

Answer:

w = ["Algorithm", "Logic", "Filter", "Software", "Network", "Parameters", "Analyze", "Algorithm", "Functionality", "Viruses"]

for i in range (len(w)):

   print(w[i].upper())

Explanation:

every element needs to be upper cased

A loop that prints the words in uppercase letters is written below with the help of Python.

What is a function?

Simply said, a function is a "chunk" of code that you may reuse repeatedly so instead of having to write it out several times. Software developers can divide an issue into smaller, more manageable parts, which can each carry out a specific task, using functions.

A function, according to a technical definition, is a relationship between an amount of parameters and a set of potential outputs, where every other input is connected to precisely one output.

All the functions are to be written in uppercase:

w = ["Algorithm", "Logic", "Filter", "Software", "Network", "Parameters", "Analyze", "Algorithm", "Functionality", "Viruses"]

for i in range (len(w)):

  print(w[i].upper())

Learn more about function, Here:

https://brainly.com/question/29050409

#SPJ5

Programming CRe-type the code and fix any errors. The code should convert non-positive numbers to 1.
if (userNum > 0)
printf("Positive.\n");
else
printf("Non-positive, converting to 1.\n");
user Num = 1;
printf("Final: %d\n", userNum);
1 #include Hem
int main(void) {
int userNum;
scanf("%d", &userNum);
return 0;

Answers

Answer:

Given

The above lines of code

Required

Rearrange.

The code is re-arrange d as follows;.

#include<iostream>

int main()

{

int userNum;

scanf("%d", &userNum);

if (userNum > 0)

{

printf("Positive.\n");

}

else

{

printf("Non-positive, converting to 1.\n");

userNum = 1;

printf("Final: %d\n", userNum);

}

return 0;

}

When rearranging lines of codes. one has to be mindful of the programming language, the syntax of the language and control structures in the code;

One should take note of the variable declarations and usage

See attachment for .cpp file

write the following function so that it returns the same result, but does

not increment the variable ptr. Your new program must not use anysquare brackets, but must use an integer variable to visit each double in the array. You may eliminate any unneeded variable.

double computeAverage(const double* scores, int nScores)

{
const double* ptr = scores;
double tot = 0;
while (ptr != scores + nScores)

{
tot += *ptr; } ptr++;

}
return tot/nScores;

b. Rewrite the following function so that it does not use any square brackets (not even in the parameter declarations) but does use the integervariable k. Do not use any of the functions such as strlen, strcpy, etc.

// This function searches through str for the character chr.
// If the chr is found, it returns a pointer into str where
// the character was first found, otherwise nullptr (not found).

const char* findTheChar(const char str[], char chr)

{
for(intk=0;str[k]!=0;k++)
if (str[k] == chr)

}

return &str[k];
return nullptr;
}

c. Now rewrite the function shown in part b so that it uses neither square brackets nor any integer variables. Your new function must not use any local variables other than the parameters.

Answers

Answer:

Explanation:

a.  

// Rewriting the given function without using any square brackets

double computeAverage(const double* scores, int nScores)

{

const double* ptr = scores;

double tot = 0;

int i;//declaring integer variable

for(i=0;i<nScores;i++)

{

//using an integer variable i to visit each double in the array

tot += *(ptr+i);

}

return tot/nScores;

}

b.

// Rewriting the given function without using any square brackets

const char* findTheChar(const char* str, char chr)

{

for(int k=0;(*(str+k))!='\0';k++)

{

if ((*(str+k)) == chr)

return (str+k);

}

return nullptr;

}

c.

//Now rewriting the function shown in part b so that it uses neither square brackets nor any integer variables

const char* findTheChar(const char* str, char chr)

{

while((*str)!='\0')

{

if ((*str) == chr)

return (str);

str++;

}

return nullptr;

}

Other Questions
Indigo Company issues 11,300 shares of restricted stock to its CFO, Mary Tokar, on January 1, 2020. The stock has a fair value of $565,000 on this date. The service period related to this restricted stock is 5 years. Vesting occurs if Tokar stays with the company until December 31, 2024. The par value of the stock is $10. At December 31, 2020, the fair value of the stock is $396,000.Required:a. Prepare the journal entries to record the restricted stock on January 1, 2014 (the date of grant), and December 31, 2015b. On July 25, 2018, Tokar leaves the company. Prepare the journal entry to account for this forfeiture. explain the political organization of the capital Spicewood Stables, Inc. was established in Dripping Springs, Texas, on April 1. The company provides stables, care for animals, and grounds for riding and showing horses. You have been hired as the new Assistant Controller. The following transactions for April are provided for your review.1.Received contributions from investors and issued $330,000 of common stock on April 1.2.Built a barn and other buildings for $165,000. On April 2, the company paid half the amount in cash on April 1 and signed a three-year note payable for the balance.3.Provided $24,900 in animal care services for customers on April 3, all on credit.4.Rented stables to customers who cared for their own animals; received cash of $11,500 on April 4.5.On April 5, received $3,900 cash from a customer to board her horse in May, June, and July (record as Unearned Revenue).6.Purchased hay and feed supplies on account on April 6 for $4,700.7.Paid $2,860 on accounts payable on April 7 for previous purchases.8.Received $1,240 from customers on April 8 on accounts receivable.9.On April 9, prepaid a two-year insurance policy for $5,700. for coverage starting in May.10.On April 28, paid $960 in cash for water utilities incurred in the month.11.Paid $15,800 in wages on April 29 for work done this month.12.Received an electric utility bill on April 30 for $1,940 for usage in April; the bill will be paid next month.1. Prepare the journal entry for each of the above transactions. 3.) When you use allCAPS, people thinkyour pls help this is due before 11:59 In Ernest Hemingways In Another Country, what characterizes his word choice? He likes to explain events in detail. He uses few, if any, adjectives. He is prone to wordiness. He uses vivid figurative language. Which image best shows a well-balanced meal, based on the MyPlate recommendations?A plate containing fruit.A plate containing fried chicken, French fries, and salad. A plate containing fish, vegetables, lemon slices, and bread.A plate containing a steak. During a football game, a receiver has just caught a pass and is standing still. Before he can move, a tackler, running at a velocity of 2.60 m/s, grabs and holds onto him so that they move off together with a velocity of 1.30 m/s. If the mass of the tackler is 122 kg, determine the mass of the receiver. Assume momentum is conserved. Simplify the trigonometric expression sin(4x) +2 sin(2x) using Double-AngleIdentities. Compounds formed when non-metals react with metals consist of particles called ionic compound Not so bad after an F- I guess. Which sentences make factual statements about Egyptian civilization? Egyptian civilization developed along the banks of the Nile River. Some historians believe that it is one of the oldest human civilizations. The fertile plains near the Nile helped the civilization grow. The bravest of all soldiers were from the Egyptian civilization. Choose the function that is a "parent function". During World War I, why was propaganda important for the war efforts?O Propaganda provided guidance on how civilians could protect themselves.O Propaganda helped rally support for government war efforts.O Propaganda encouraged enemy soldiers to surrender.O Propaganda brought neutral nations into the war.Save and ExitNetSMark this and retum Analicen el cariotipo humano y den dos ejemplos de pares de cromosomas metacntricos, dos ejemplos de pares telocntricos y dos ejemplos de pares acrocntricos. Name the types of angles shown.Check all that apply. Why are some right triangles considered special? Which of the following reasons can be used to justify statement #4 in the proof?A SASB the transitive property C the reflexive property D CPCTC Short-duration strikes and other small-scale offensive actions conducted with specialized military capabilities to seize, destroy, capture, exploit, recover, or damage designated targets in hostile, denied, or diplomatically and/or politically sensitive environments is called _____. It differs from other offensive actions in the level of diplomatic or political risk, the operational techniques employed, and the degree of discriminate and precise use of force to achieve specific objectives. When the health department tested private wells in a county for two impurities commonly found in drinking water, it found that 10% of the wells had neither impurity, 90% had impurity A, and 20% had impurity B. (Obviously, some had both impurities.) If a well is randomly chosen from those in the county, find the probability distribution for Y, the number of impurities found in the well.