Explanation:
The taskbar contains app buttons that allow you to quickly run the File Explorer or Microsoft Edge apps.
Hope this helps
LAB: Acronyms
An acronym is a word formed from the initial letters of words in a set phrase. Write a program whose input is a phrase and whose output is an acronym of the input. If a word begins with a lower case letter, don't include that letter in the acronym. Assume there will be at least one upper case letter in the input.
If the input is
Institute of Electrical and Electronics Engineers
the output should be
IEEE
Answer:
LAB means laboratory
IEEE means institute of electrical and electronic engineer
Assume myString and yourString are variables of type String already declared and initialized. Write ONE line of code that sets yourString to the first character and the last character of myString added to myString variable.
Answer:
line of code :
newString=myString+myString.charAt(0)+myString.charAt(myString.length()-1);
Explanation:
In Java, the + is used for concatenation
method
charAt() will return the character from the given index from string
myString.charAt(0) will return E
myString.charAt(myString.length()-1)
Given two character strings s1 and s2. Write a Pthread program to find out the number of substrings, in string s1, that is exactly the same as s2
Answer:
Explanation:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define MAX 1024
int total = 0 ;
int n1, n2;
char s1, s2;
FILE fp;
int readf(FILE fp)
{
if((fp=fopen("strings.txt", "r"))==NULL) {
printf("ERROR: can’t open string.txt!\n");
return 0;
}
s1=(char)malloc(sizeof(char)MAX);
if(s1==NULL) {
printf("ERROR: Out of memory!\n");
return 1;
}
s2=(char)malloc(sizeof(char)MAX);
if(s1==NULL) {
printf("ERROR: Out of memory!\n");
return 1;
}
/* read s1 s2 from the file */
s1=fgets(s1, MAX, fp);
s2=fgets(s2, MAX, fp);
n1=strlen(s1); /* length of s1 */
n2=strlen(s2)-1; /* length of s2 */
if(s1==NULL || s2==NULL || n1<n2) /* when error exit */
return 1;
}
int num_substring(void)
{
int i, j, k;
int count;
for(i=0; i<=(n1-n2); i++) {
count=0;
for(j=i, k=0; k<n2; j++, k++){ /* search for the next string of size of n2 */
if((s1+j)!=(s2+k)) {
break;
}
else
count++;
if(count==n2)
total++; /* find a substring in this step */
}
}
return total;
}
int main(int argc, char argv[])
{
int count;
readf(fp);
count=num_substring();
printf("The number of substrings is: %d\n", count);
return 1;
}
How can COUNTIF, COUNTIFS, COUNT, COUNTA, and COUNTBLANK functions aide a company to support its mission or goals
Answer:
Following are the responses to these questions:
Explanation:
It employs keywords to autonomously do work tasks. Users can type numbers directly into the formulas or use the following formulae, so any data the cells referenced provide would be used in the form.
For instance, this leadership involves accounting, and Excel is concerned with organizing and organizing numerical data. In this Equation, I can discover all its information in the data. This idea is simple me count the number many cells containing a number, and also the number of integers. It counts integers in any sorted number as well. As both financial analysts, it is helpful for the analysis of the data if we want to maintain the same number of neurons.
Complete the AscendingAndDescending application so that it asks a user to enter three integers. Display them in ascending and descending order.An example of the program is shown below:Enter an integer... 1 And another... 2 And just one more... 3 Ascending: 1 2 3 Descending: 3 2 1GradingWrite your Java code in the area on the right. Use the Run button to compile and run the code. Clicking the Run Checks button will run pre-configured tests against your code to calculate a grade.Once you are happy with your results, click the Submit button to record your score.
Answer:
Following are the solution to the given question:
import java.util.Scanner;//import package
public class AscendingAndDescending//defining a class AscendingAndDescending
{
public static void main(String[] args) //main method
{
int n1,n2,n3,min,max,m;
Scanner in = new Scanner(System.in);//creating Scanner class object
System.out.print("Enter an integer: ");//print message
n1 = in.nextInt();//input value
System.out.print("And another: ");//print message
n2 = in.nextInt();//input value
System.out.print("And just one more: ");//print message
n3 = in.nextInt();//input value
min = n1; //use min variable that holds value
max = n1; //use mix variable that holds value
if (n2 > max) max = n2;//use if to compare value and hols value in max variable
if (n3 > max) max = n3;//use if to compare value and hols value in max variable
if (n2 < min) min = n2;//use if to compare value and hols value in min variable
if (n3 < min) min = n3;//use if to compare value and hols value in min variable
m = (n1 + n2 + n3) - (min + max);//defining m variable that arrange value
System.out.println("Ascending: " + min + " " + m + " " + max);//print Ascending order value
System.out.println("Descending: " + max + " " + m + " " + min);//print Descending order value
}
}
Output:
Enter an integer: 8
And another: 9
And just one more: 7
Ascending: 7 8 9
Descending: 9 8 7
Explanation:
In this program inside the main method three integer variable "n1,n2, and n3" is declared that inputs value from the user end and also defines three variable "min, max, and m" that uses the conditional statement that checks inputs value and assigns value according to the ascending and descending order and prints its values.
Suppose that a queue is implemented using a circular array of size 12. What is the value of last after the following operations?
10 enqueue operations
5 dequeue operations
6 enqueue operations
10 dequeue operations
8 enqueue operations
2 dequeue operations
3 enqueue operations
Last = 10
Answer:
10
Explanation:
An enqueue operation is a function that adds an element(value) to a queue array. A dequeue operations removes an element from a queue array. Queue arrays follow a first-in-first-out approach, so elements that are first stored in the queue are removed/accessed first(enqueue operations add elements at the rear of the queue array).
The following operations leave 10 elements in the queue of array size 12 after its done:
10 enqueue operations= adds 10 elements
5 dequeue operations= removes 5 elements( 5 elements left in queue)
6 enqueue operations= adds 6 elements(11 elements in queue)
10 dequeue operations= removes 10 elements(1 element left in queue)
8 enqueue operations= adds 8 elements(9 elements in queue)
2 dequeue operations= removes 2 elements(7 elements left in queue)
3 enqueue operations= adds 3 elements(10 elements in queue)
Therefore there are 10 elements in the queue after enqueue and dequeue operations.
You know different types of networks. If two computing station high speed network link for proper operation which of the following network type should be considered as a first priority?
MAN
WAN
WLAN
LAN
All of these
Answer:
All of these.
PLZ MARK ME BRAINLIEST.
Cardinality ratios often dictate the detailed design of a database. The cardinality ratio depends on the real-world meaning of the entity types involved and is defined by the specific application. For the binary relationships below, suggest cardinality ratios based on the common-sense meaning of the entity types. Clearly state any assumptions you make.
Entity 1 Cardinality Ratio Entity 2
1. Student SocialSecurityCard
2. Student Teacher
3. ClassRoom Wall
4. Country CurrentPresident
5. Course TextBook
6. Item (that can
be found in an
order) Order
7. Student Class
8. Class Instructor
9. Instructor Office
10. E-bay Auction item E-bay bid
Solution :
ENTITY 1 CARDINALITY RATIO ENTITY 2
1. Student 1 to many Social security card
A student may have more than one
social security card (legally with the
same unique social security number),
and every social security number belongs
to a unique.
2. Student Many to Many Teacher
Generally students are taught by many
teachers and a teacher teaches many students.
3.ClassRoom Many to Many Wall
Do not forget that the wall is usually
shared by adjacent rooms.
4. Country 1 to 1 Current President
Assuming a normal country under normal
circumstances having one president at a
time.
5. Course Many to Many TextBook
A course may have many textbooks and
text book may be prescribed for different
courses.
6. Item Many to Many Order
Assuming the same item can appear
in different orders.
7. Student Many to Many Class
One student may take several classes.
Every class usually has several students.
8. Class Many to 1 Instructor
Assuming that every class has a unique
instructor. In case instructors were allowed
to team teach, this will be many-many.
9. Instructor 1 to 1 Office
Assuming every instructor has only one
office and it is not shared. In case of offices
shared by 2 instructors, the relationship
will be 2-1. Conversely, if any instructor has a joint
appointment and offices in both departments,
then the relationship will be 1-2. In a very general
case, it may be many-many.
10. E-bay Auction item 1-Many E-bay bid
1 item has many bids and a bid is unique
to an item.
Write a RainFall class that stores the total rainfall for each of 12 months into an array of doubles. The program should have methods that return the following:
the total rainfall for the year
the average monthly rainfall
the month with the most rain
the month with the least rain
Demonstrate the class in a complete program.
Input Validation: Do not accept negative numbers for monthly rainfall figures.
import java.io.*;
import java.util.*;
public class Rainfall
{
Scanner in = new Scanner(System.in);
private int month = 12;
private double total = 0;
private double average;
private double standard_deviation;
private double largest;
private double smallest;
private double months[];
public Rainfall()
{
months = new double[12];
}
public void setMonths()
{
for(int n=1; n <= month; n++)
{
System.out.println("Enter the rainfall (in inches) for month #" + n + ":" );
months[n-1] = in.nextInt();
}
}
public double getTotal()
{
total = 0;
for(int i = 0; i < 12; i++)
{
total = total + months[i];
}
System.out.println("The total rainfall for the year is" + total);
return total;
}
public double getAverage()
{
average = total/12;
System.out.println("The average monthly rainfall is" + average);
return average;
}
public double getLargest()
{
double largest = 0;
int largeind = 0;
for(int i = 0; i < 12; i++)
{
if (months[i] > largest)
{
largest = months[i];
largeind = i;
}
}
System.out.println("The largest amout of rainfall was" + largest +
"inches in month" + (largeind + 1));
return largest;
}
public double getSmallest()
{
double smallest = Double.MAX_VALUE;
int smallind = 0;
for(int n = 0; n < month; n++)
{
if (months[n] < smallest)
{
smallest = months[n];
smallind = n;
}
}
System.out.println("The smallest amout of rainfall was" + smallest +
"inches in month " + (smallind + 1));
return smallest;
}
public static void main(String[] args)
{
Rainfall r = new Rainfall();
r.setMonths();
System.out.println("Total" + r.getTotal());
System.out.println("Smallest" + r.getSmallest());
System.out.println("Largest" + r.getLargest());
System.out.println("Average" + r.getAverage());
}
}
Answer:
Explanation:
The code provided worked for the most part, it had some gramatical errors in when printing out the information as well as repeated values. I fixed and reorganized the printed information so that it is well formatted. The only thing that was missing from the code was the input validation to make sure that no negative values were passed. I added this within the getMonths() method so that it repeats the question until the user inputs a valid value. The program was tested and the output can be seen in the attached image below.
import java.io.*;
import java.util.*;
class Rainfall
{
Scanner in = new Scanner(System.in);
private int month = 12;
private double total = 0;
private double average;
private double standard_deviation;
private double largest;
private double smallest;
private double months[];
public Rainfall()
{
months = new double[12];
}
public void setMonths()
{
for(int n=1; n <= month; n++)
{
int answer = 0;
while (true) {
System.out.println("Enter the rainfall (in inches) for month #" + n + ":" );
answer = in.nextInt();
if (answer > 0) {
months[n-1] = answer;
break;
}
}
}
}
public void getTotal()
{
total = 0;
for(int i = 0; i < 12; i++)
{
total = total + months[i];
}
System.out.println("The total rainfall for the year is " + total);
}
public void getAverage()
{
average = total/12;
System.out.println("The average monthly rainfall is " + average);
}
public void getLargest()
{
double largest = 0;
int largeind = 0;
for(int i = 0; i < 12; i++)
{
if (months[i] > largest)
{
largest = months[i];
largeind = i;
}
}
System.out.println("The largest amount of rainfall was " + largest +
" inches in month " + (largeind + 1));
}
public void getSmallest()
{
double smallest = Double.MAX_VALUE;
int smallind = 0;
for(int n = 0; n < month; n++)
{
if (months[n] < smallest)
{
smallest = months[n];
smallind = n;
}
}
System.out.println("The smallest amount of rainfall was " + smallest +
" inches in month " + (smallind + 1));
}
public static void main(String[] args)
{
Rainfall r = new Rainfall();
r.setMonths();
r.getTotal();
r.getSmallest();
r.getLargest();
r.getAverage();
}
}
Write an expression that evaluates to True if the string associated with s1 is greater than the string associated with s2
Answer:
Explanation:
The following code is written in Python. It is a function that takes two string parameters and compares the lengths of both strings. If the string in variable s1 is greater then the function returns True, otherwise the function returns False. A test case has been provided and the output can be seen in the attached image below.
def compareStrings(s1, s2):
if len(s1) > len(s2):
return True
else:
return False
print(compareStrings("Brainly", "Competition"))
1. Describe data and process modeling concepts and tools.
Answer:
data is the raw fact about its process
Explanation:
input = process= output
data is the raw fact which gonna keeps in files and folders. as we know that data is a information keep in our device that we use .
Answer:
Data and process modelling involves three main tools: data flow diagrams, a data dictionary, and process descriptions. Describe data and process tools. Diagrams showing how data is processed, transformed, and stored in an information system. It does not show program logic or processing steps.
now now now now mowewweedeeee
Answer:
15
Inside the type declaration, you specify the maximum length the entry can be. For branch, it would be 15.
I can't seem to type the full "vc(15)" phrase because brainly won't let me.
If the signal is going through a 2 MHz Bandwidth Channel, what will be the maximum bit rate that can be achieved in this channel? What will be the appropriate signal level?
Answer:
caca
Explanation:
In this era of technology, everyone uses emails for mail and messages. Assume you have also used the
mailboxes for conversation. Model the object classes that might be used in Email system implementation
to represent a mailbox and an email message.
Assume You are working as a software engineer and now you have been asked to deliver a presentation to
a manager to justify the hiring of a system architect for a new project. Write a list of bullet points setting
out the key points in your presentation in which you explain the importance of software architecture
Answer:
A class may be a structured diagram that describes the structure of the system.
It consists of sophistication name, attributes, methods, and responsibilities.
A mailbox and an email message have certain attributes like, compose, reply, draft, inbox, etc.
Software architecture affects:
Performance, Robustness, Distributability, Maintainability.
Explanation:
See attachment for the Model object classes which may be utilized in the system implementation to represent a mailbox and an email message.
Advantages:
Large-scale reuse Software architecture is vital because it affects the performance, robustness, distributability, and maintainability of a system.
Individual components implement the functional system requirements, but the dominant influence on the non-functional system characteristics is that the system's architecture.
Three advantages of System architecture:
• Stakeholder communication: The architecture may be a high-level presentation of the system which will be used as attention for discussion by a variety of various stakeholders.
• System analysis: making the system architecture explicit at an early stage within the system development requires some analysis.
• Large-scale reuse:
An architectural model may be a compact, manageable description of how a system is organized and the way the components interoperate.
The system architecture is usually an equivalent for systems with similar requirements then can support large-scale software reuse..
Fill in multiple blanks for [x], [y], [z]. Consider a given TCP connection between host A and host B. Host B has received all from A all bytes up to and including byte number 2000. Suppose host A then sends three segments to host B back-to-back. The first, second and third segments contain 50, 600 and 100 bytes of user data respectively. In the first segment, the sequence number is 2001, the source port number is 80, and the destination port number is 12000. If the first segment, then third segment, then second segment arrive at host B in that order, consider the acknowledgment sent by B in response to receiving the third segment. What is the acknowledgement number [x], source port number [y] and destination port number [z] of that acknowledgement
Your organization has started receiving phishing emails. You suspect that an attacker is attempting to find an employee workstation they can compromise. You know that a workstation can be used as a pivot point to gain access to more sensitive systems. Which of the following is the most important aspect of maintaining network security against this type of attack?
A. Network segmentation.B. Identifying a network baseline.C. Documenting all network assets in your organization.D. Identifying inherent vulnerabilities.E. User education and training.
Answer:
E). User education and training.
Explanation:
In the context of network security, the most significant aspect of ensuring security from workstation cyberattacks would be 'education, as well as, training of the users.' If the employee users are educated well regarding the probable threats and attacks along with the necessary safety measures to be adopted and trained adequately to use the system appropriately so that the sensitive information cannot be leaked while working on the workstation and no networks could be compromised. Thus, option E is the correct answer.
Validate that the user age field is at least 21 and at most 35. If valid, set the background of the field to LightGreen and assign true to userAgeValid. Otherwise, set the background to Orange and userAgeValid to false.HTML JavaScript 1 var validColor-"LightGreen"; 2 var invalidColor"Orange" 3 var userAgeInput -document.getElementByIdC"userAge"); 4 var formWidget -document.getElementByIdC"userForm"); 5 var userAgeValid - false; 7 function userAgeCheck(event) 10 11 function formCheck(event) 12 if (luserAgeValid) { 13 14 15 16 17 userAgeInput.addEventListener("input", userAgeCheck); 18 formWidget.addEventListener('submit', formCheck); event.preventDefault); 3 Check Iry again
Answer:
Explanation:
The code provided had many errors. I fixed the errors and changed the userAgeCheck function as requested. Checking the age of that the user has passed as an input and changing the variables as needed depending on the age. The background color that was changed was for the form field as the question was not very specific on which field needed to be changed. The piece of the code that was created can be seen in the attached image below.
var validColor = "LightGreen";
var invalidColor = "Orange";
var userAgeInput = document.getElementById("userAge");
var formWidget = document.getElementById("userForm");
var userAgeValid = false;
function userAgeCheck(event) {
if ((userAgeInput >= 25) && (userAgeInput <= 35)) {
document.getElementById("userForm").style.backgroundColor = validColor;
userAgeValid = true;
} else {
document.getElementById("userForm").style.backgroundColor = invalidColor;
userAgeValid = false;
}
};
function formCheck(event) {};
if (!userAgeValid) {
userAgeInput.addEventListener("input", userAgeCheck);
formWidget.addEventListener('submit', formCheck);
event.preventDefault();
}
Which symbol is used to identify edge-triggered flip-flops
Answer:
A triangle on the Clock input.
Print the two-dimensional list mult_table by row and column. Hint: Use nested loops.
Sample output with input: '1 2 3,2 4 6,3 6 9':
1 | 2 | 3
2 | 4 | 6
3 | 6 | 9
How can I delete that whitespace?
Answer:
The program is as follows:
[tex]mult\_table = [[1, 2, 3], [2, 4, 6], [3, 6, 9]][/tex]
count = 1
for row in mult_table:
for item in row:
if count < len(row):
count+=1
print(item,end="|")
else:
print(item)
count = 1
Explanation:
This initializes the 2D list
[tex]mult\_table = [[1, 2, 3], [2, 4, 6], [3, 6, 9]][/tex]
This initializes the count of print-outs to 1
count = 1
This iterates through each rows
for row in mult_table:
This iterates through each element of the rows
for item in row:
If the number of print-outs is less than the number of rows
if count < len(row):
This prints the row element followed by |; then count is incremented by 1
count+=1
print(item,end="|")
If otherwise
else:
This prints the row element only
print(item)
This resets count to 1, after printing each row
count = 1
To delete the whitespace, you have to print each element as: print(item,end="|")
See that there is no space after "/"
Answer:
count = 1
for row in mult_table:
for item in row:
if count < len(row):
count+=1
print(item,end=" | ")
else:
print(item)
count = 1
Explanation: Other answers didnt have the spacing correct
Write code that prints: Ready! userNum ... 2 1 Go! Your code should contain a for loop. Print a newline after each number and after each line of text. Ex: If the input is: 3 the output is: Ready! 3 2 1 Go!
Answer:
Kindly find the code snippet in the explanation written in kotlin language
Explanation:
fun main(args: Array<String>) {
var num:Int
println("Enter a num")
num= Integer.valueOf(readLine())
for(i in num downTo 1){
if(i==num){
print("Ready!")
print(" ")
}
print(i)
print(" ")
if(i==1){
print(" ")
print("Go!")
}
}
}
This function too can also work
fun numTo(num:Int){
if (num>0) for(i in num downTo 1) print("$i ")
println("Go!")
Jane is a full-time student on a somewhat limited budget, taking online classes, and she loves to play the latest video games. She needs to update her computer and wonders what to purchase. Which of the following might you suggest?
a. A workstation with a 3.9 GHz quad-core processor, 16 gigabytes of RAM, and a 24" monitor.
b. A laptop system with a 3.2 GHz processor. 6 gigabytes of RAM, and a 17" monitor.
c. A desktop system with a 1.9 GHz processor, 1 gigabyte of RAM, and a 13" monitor
d. A handheld PC (with no smartphone functionality)
Answer:
a. A workstation with a 3.9 GHz quad-core processor, 16 gigabytes of RAM, and a 24" monitor.
Explanation:
From the description, Jane needs to be able to multitask and run various programs at the same time in order to be efficient. Also since she wants to play the latest video games she will need high end hardware. Therefore, from the available options the best one would be a workstation with a 3.9 GHz quad-core processor, 16 gigabytes of RAM, and a 24" monitor. This has a very fast cpu with 4 cores to process various threads at the same time. It also has 16GB of memory to be able to multitask without problems and a 24" monitor. From the available options this is the best choice.
What variable(s) is/are used in stack to keep track the position where a new item to be inserted or an item to be deleted from the stack
Answer:
Hence the answer is top and peek.
Explanation:
In a stack, we insert and delete an item from the top of the stack. So we use variables top, peek to stay track of the position.
The insertion operation is understood as push and deletion operation is understood as entering stack.
Hence the answer is top and peek.
Java programming
*11.13 (Remove duplicates) Write a method that removes the duplicate elements from
an array list of integers using the following header:
public static void removeDuplicate(ArrayList list)
Write a test program that prompts the user to enter 10 integers to a list and displays
the distinct integers separated by exactly one space. Here is a sample run:
Enter ten integers: 34 5 3 5 6 4 33 2 2 4
The distinct integers are 34 5 3 6 4 33 2
Answer:
The program in Java is as follows:
import java.util.*;
public class Main {
public static void removeDuplicate(ArrayList<Integer> list){
ArrayList<Integer> newList = new ArrayList<Integer>();
for (int num : list) {
if (!newList.contains(num)) {
newList.add(num); } }
for (int num : newList) {
System.out.print(num+" "); } }
public static void main(String args[]){
Scanner input = new Scanner(System.in);
ArrayList<Integer> list = new ArrayList<Integer>();
System.out.print("Enter ten integers: ");
for(int i = 0; i<10;i++){
list.add(input.nextInt()); }
System.out.print("The distinct integers are: ");
removeDuplicate(list);
}}
Explanation:
This defines the removeDuplicate function
public static void removeDuplicate(ArrayList<Integer> list){
This creates a new array list
ArrayList<Integer> newList = new ArrayList<Integer>();
This iterates through the original list
for (int num : list) {
This checks if the new list contains an item of the original list
if (!newList.contains(num)) {
If no, the item is added to the new list
newList.add(num); } }
This iterates through the new list
for (int num : newList) {
This prints every element of the new list (At this point, the duplicates have been removed)
System.out.print(num+" "); } }
The main (i.e. test case begins here)
public static void main(String args[]){
Scanner input = new Scanner(System.in);
This declares the array list
ArrayList<Integer> list = new ArrayList<Integer>();
This prompts the user for ten integers
System.out.print("Enter ten integers: ");
The following loop gets input for the array list
for(int i = 0; i<10;i++){
list.add(input.nextInt()); }
This prints the output header
System.out.print("The distinct integers are: ");
This calls the function to remove the duplicates
removeDuplicate(list);
}}
Can we update App Store in any apple device. (because my device is kinda old and if want to download the recent apps it aint showing them). So is it possible to update???
Please help
Answer:
For me yes i guess you can update an app store in any deviceI'm not sure×_× mello ×_×For the following 4-bit operation, assuming these register are ONLY 4-bits in size, which status flags are on after performing the following operation? Assume 2's complement representation. 1010+0110
a) с
b) Z
c) N
Answer:
All flags are On ( c, z , N )
Explanation:
Given data:
4-bit operation
Assuming 2's complement representation
Determine status flags that are on after performing 1010+0110
1 1
1 0 1 0
0 1 1 0
1 0 0 0 0
we will carry bit = 1 over
hence C = 1
given that: carry in = carry out there will be zero ( 0 ) overflow
hence V = 0
also Z = 1
But the most significant bit is N = 1
This means that the surface area is composed of the base area (i.e., the area of bottom square) plus the side area (i.e., the sum of the areas of all four triangles). You are given the following incomplete code to calculate and print out the total surface area of a square pyramid: linclude > h: base azea- calcBasekrea (a) : cout << "Base auxface area of the squaze pyzamid is" << base area << "square feet."< endi: // add your funetion call to calculate the side ares and assign // the zesult to side area, and then print the result //hdd your function call to print the total surface area return 0F float calcBaseArea (float a) return pou (a, 2) /I add your function definicion for calcSideärea here // add your function definition tor prntSurfârea here This code prompts for, and reads in the side length of the base (a) and height of a square pyramid (h) in feet, and then calculates the surface area. The function prototype (i.e. function declaration), function definition, and function call to calculate and print the base area has already been completed for you. In the above program, a and h are declared in the main function and are local to main. Since a is a local variable, notice how the length a must be passed to calcBaseArea to make this calculation. One of your tasks is to add a new function called calesidearea that computes and returns the side area of the square pyramid. Given that the formula uses both the length a and height h of the square pyramid, you must pass these two local variables to this function. You will assign the returned value of this function to side area and then print the value to the terminal. Refer to what was done for calcBaseArea when adding your code. Your other task is to add a new function called prntsprfArea that accepts the base area and side area values (i.e, these are the parameters) and prints out the total surface area of the square pyramid inside this function. Since this function does not return a value to the calling function, the return type of this function should be void Now, modify the above program, referring to the comments included in the code. Complete the requested changes, and then save the file as Lab7A. opp, making sure it compiles and works as expected. Note that you will submit this file to Canvas
Answer:-
CODE:
#include <iostream>
#include<cmath>
using namespace std;
float calcBaseArea(float a);
float calcSideArea(float s,float l);
void prntSprfArea(float base_area,float side_area);
int main()
{
float h;
float a;
float base_area
float side_area;
cout<<"Enter the side length of the base of the square pyramid in feet : ";
cin>>a;
cout<<"Enter the height of the square pyramid in feet : ";
cin>>h;
base_area=calcBaseArea(a);
side_area=calcSideArea(a,h);
cout<<"Base surface area of the square pyramid is "<<base_area<<" square feet. "<<endl;
cout<<"Side area of the square pyramid is "<<side_area<<" square feet."<<endl;
prntSprfArea(base_area,side_area);
return 0;
}
float calcBaseArea(float a)
{
return pow(a,2);
}
float calcSideArea(float s,float l)
{
float area=(s*l)/2;
return 4*area;
}
void prntSprfArea(float base_area,float side_area)
{
cout<<"Total surface area of the pyramid is "<<base_area+side_area<<" square feet.";
OUTPUT:
Write a recursive method to form the sum of two positive integers a and b. Test your program by calling it from a main program that reads two integers from the keyboard and users your method to complete and print their sum, along with two numbers.
Answer:
see the code snippet below writing in Kotlin Language
Explanation:
fun main(args: Array<String>) {
sumOfNumbers()
}
fun sumOfNumbers(): Int{
var firstNum:Int
var secondNum:Int
println("Enter the value of first +ve Number")
firstNum= Integer.valueOf(readLine())
println("Enter the value of second +ve Number")
secondNum= Integer.valueOf(readLine())
var sum:Int= firstNum+secondNum
println("The sum of $firstNum and $secondNum is $sum")
return sum
}
14. For the declaration, int a[4] = {1, 2, 3};, which one is right in the following description-
(
A. The meaning of &a[1] and a[1] are same B. The value of a[1] is 1-
C. The value of a[2] is 3
D. The size of a is 12 bytes
Answer:
A.
thanks later baby HAHAHAHAHAA
Miguel has decided to use cloud storage. He needs to refer to one of the files he has stored there, but his internet service has been interrupted by a power failure in his area. Which aspect of his resource (the data he stored in the cloud) has been compromised
Answer: Availability
Explanation:
You are given a sequence of n songs where the ith song is l minutes long. You want to place all of the songs on an ordered series of CDs (e.g. CD 1, CD 2, CD 3,... ,CD k) where each CD can hold m minutes. Furthermore, (1) The songs must be recorded in the given order, song 1, song 2,..., song n. (2) All songs must be included. (3) No song may be split across CDs. Your goal is to determine how to place them on the CDs as to minimize the number of CDs needed. Give the most efficient algorithm you can to find an optimal solution for this problem, prove the algorithm is correct and analyze the time complexity
Answer:
This can be done by a greedy solution. The algorithm does the following:
Put song 1 on CD1.
For song 1, if there's space left on the present CD, then put the song on the present CD. If not, use a replacement CD.
If there are not any CDs left, output "no solution".
Explanation:
The main thing is prove the correctness, do that by the "greedy stays ahead argument". For the primary song, the greedy solution is perfect trivially.
Now, let the optimal solution match the greedy solution upto song i. Then, if the present CD has space and optimal solution puts song (i+1) on an equivalent CD, then the greedy and optimal match, hence greedy is not any worse than the optimal.Else, optimal puts song (i + 1) on subsequent CD. Consider an answer during which only song (i + 1) is moved to the present CD and zip else is modified. Clearly this is often another valid solution and no worse than the optimal, hence greedy is not any worse than the optimal solution during this case either. This proves the correctness of the algorithm. As for every song, there are constantly many operations to try to do, the complexity is O(n).