Answer:
try typing the following:
String lc = s.toLowerCase();
String uc = s.toUpperCase();
if(lc == uc){
System.out.println("*")
}
What is the difference between a row and a column? Give examples
Answer:
bruh this a math question not tech
Explanation:
Answer:
a row is like stuff lined up side by side and a column could be many things but one of then is like a row of stuff but vertical
hope i help can u pls brainliest i need it :)
Write a short quiz program which asks three true/false questions and stores the user's answers as booleans. At the end the program it should print the user's answers with the correct answers.
Note: you should use the same quiz questions and correct answers as the sample run below.
Sample run:
Java is a programming language, true or false?
true
Only numbers can be stored by variables in Java, true or false?
true
There are only 2 possible values which can be held by a boolean variable, true or false?
false
Question 1 - Your answer: true. Correct answer: true
Question 2 - Your answer: true. Correct answer: false
Question 3 - Your answer: false. Correct
AP CS A Unit 1: Lesson 3 - Coding Activity 3
this answering question interface is bleh
The concept of boolean variables is that; variables declared as boolean type can only take any of two values. The variable can either be true or false. Such variable cannot take any other value apart from these two.
The short quiz program is as follows.
Please note that comments are used to explain difficult lines.
import java.util.*;
public class shortQuiz{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
//This declares the variables that represent correct answers as boolean data type; the variables are also initialized
boolean q1 = true, q2 = false, q3 = true;
//This declares the response to each question as boolean data type
boolean q1response, q2response, q3response;
//This prints the first question
System.out.print("Java is a programming language, true or false? ");
//This gets input for the first response
q1response = input.nextBoolean();
//This prints the second question
System.out.print("Only numbers can be stored by variables in Java, true or false? ");
//This gets input for the second response
q2response = input.nextBoolean();
//This prints the third question
System.out.print("There are only 2 possible values which can be held by a boolean variable, true or false? ");
//This gets input for the third response
q3response = input.nextBoolean();
//This prints your first response, alongside the correct answer to the first question
System.out.println("Question 1 - Your answer: "+q1response+". Correct answer: "+q1);
//This prints your second response, alongside the correct answer to the second question
System.out.println("Question 2 - Your answer: "+q2response+". Correct answer: "+q2);
//This prints your third response, alongside the correct answer to the third question
System.out.println("Question 3 - Your answer: "+q3response+". Correct answer: "+q3);
//The program ends here
}
}
See attached image for program sample run.
The above program initializes the correct answers using boolean variables. The correct answers are then printed, after the user answers the three questions.
Read more about boolean variables at:
https://brainly.com/question/16843003
WILL MARK AS BRAINLIEST
Describe the environmental issues in India and list ways that technology has been used to address these issues.
India has been having to engineer better technology to better prepare people in india for the brutal monsoon seasons in india
what is the seven deadly sins
Answer:
Kill
lie
fight
..
..
.
..
What is the use of the name box
in excel?
As a twist on the Hello World exercise, you are going to be the end user of the Hello class. This class is designed to greet the user in a variety of world languages. For this task, complete the following:
Use the Scanner class to ask the user for their name.
Create a Hello object by passing the name to the constructor.
Call at least 3 methods from the Hello class to print the greeting in 3 different languages.
Remember to write your code in the HelloTester class, but make sure you take a look at the Hello class so that you know the names of the methods you need to use.
Answer:
Here is the Hello class:
public class Hello { //class name
private String name; //to store the name
public Hello (String names) //parameterized constructor
{ name = names; }
public void English() { //method to greet user in english
System.out.print("Hello "); //displays Hello on output screen
System.out.print(name); //displays user name
System.out.println("!"); } //displays exclamation mark symbol
public void Spanish(){ //method to greet user in spanish
System.out.print("Hola "); //displays Hello on output screen
System.out.print(name); //displays user name
System.out.println("!"); } //displays exclamation mark symbol
public void French() { //method to greet user in french
System.out.print("Bonjour "); //displays Hello on output screen
System.out.print(name); //displays user name
System.out.println("!"); } } //displays exclamation mark symbol
Explanation:
Here is the HelloTester class:
import java.util.Scanner; //to accept input from user
public class HelloTester { //class name
public static void main (String[]args) { //start of main method
String name; //to store the name of user
Scanner input = new Scanner(System.in); //creates Scanner class object
System.out.println("Enter name?" ); //prompts user to enter name
name = input.nextLine(); //scans and reads the name from user
Hello hello = new Hello(name); //creates Hello class object and calls constructor by passing name
hello.English(); //calls English method using object hello to greet in english
hello.Spanish(); //calls Spanish method using object hello to greet in spanish
hello.French(); } } //calls French method using object hello to greet in french
The output of the program is:
Enter name? user Hello user! Hola user! Bonjour user!
The screenshot of the program along with its output is attached.
Java is one of the most popular programming languages that is being widely used in the IT industry. It is simple, robust, and helps us to reuse the code.
The required program is,
\\import java.util.Scanner;
class Hello
{
private String name;
public Hello(String yourName)
{
name=yourName;
}
public void english()
{
System.out.print("Hello ");
System.out.print(name);
System.out.println("!");
}
public void spanish()
{
System.out.print("Holla ");
System.out.print(name);
System.out.println("!");
}
public void french()
{
System.out.print("Bonjour ");
System.out.print(name);
System.out.println("!");
}
public void german()
{
System.out.print("Hallo ");
System.out.print(name);
System.out.println("!");
}
public void russian()
{
System.out.print("Privet ");
System.out.print(name);
System.out.println("!");
}
public void chinese()
{
System.out.print("Ni hao ");
System.out.print(name);
System.out.println("!");
}
}
public class HelloTester
{
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
String name;
//Accepting the name
System.out.print("\nEnter your name: ");
name=input.next();
/creating an object of Hello class
Hello hello=new Hello(name);
System.out.println("\nGreeting in English: ");
System.out.println("-------------------------------------");
hello.english();
//calling the methods to greet in different languages
System.out.println("\nGreeting in Spanish: ");
System.out.println("-------------------------------------");
hello.spanish();
System.out.println("\nGreeting in French: ");
System.out.println("-------------------------------------");
hello.french();
System.out.println("\nGreeting in German: ");
System.out.println("-------------------------------------");
hello.german();
System.out.println("\nGreeting in Russian: ");
System.out.println("-------------------------------------");
hello.russian();
System.out.println("\nGreeting in Chinese: ");
System.out.println("-------------------------------------");
hello.chinese();
System.out.print("\n");
}
}
\\
So, the output is attached below:
Learn more about the topic Java Program:
https://brainly.com/question/19271625
(ill give brainliest to the first one who answers)
Try out the improved version of the pet app that gives the user information about pet stores close by, which uses new sources of input. Determine the information that the app gets from each source of input. (please answer each and every one of them)
USER
PHONE SENSOR
INTERNET
Answer: it gives address the time to get there the things they selll
Explanation:
What is one reason to create a study check list
Scenario: You are part of an IT group managing Active Directory for a mid-size organization. A contracted research group with their own IT team operating from a remote location with a slow network connection has requested that they be able to setup a Child Domain in your organization's domain. The remote IT teams argument is based on their slow network, and their need to access and administer the local server that would need to exist in their remote location. Your team is split between allowing the Child Domain or recommending an Organizational Unit and delegating the remote IT team access. Yours is the deciding vote -- and cost is being considered a deciding factor. What option do you support as the best option in this scenario? What DC configuration for the remotely located server would be the best option?
If instead of cost, the deciding factor was the slow speed of their network, what option would you support as the best option?
Explanation:
1.
the answer to the first question is organizational unit. this is because in this scenario that we have before us, cost is a deciding factor. a unit as this can adapt to changes, it is flexible and also not very complex
2.
answer to question 2 is PDC emulator. this emulator can perform the function synchronization of time across every domain controller that is in the domain. other of its functions are, authentication and changing of passwords.
3.
the answer to the 3rd question is child domain. It is a factor in this scenario because it works well in a situation where there is an issue of slow network connection.
Behaving in an acceptable manner within a workplace environment is referred to as having
restraint
workplace etiquette
patience
experience
Answer:
Workplace Etiquette
Explanation:
Hope dis helps
Answer:
B) workplace etiquette
Explanation:
In which setting would you be least likely to find a full-time A/V technician?
A.) stadium
B.) concert hall
B.) restaurant
D.) school
Answer: resturant
Explanation: Resturants are about making food, not about making electric. The answer to the question is resturant.
Hope this helps!
What is the force produced by a 100 kg object that accelerates at 5 m/s2?
Answer:
500N
Explanation:
force=mass*acceleration
f=m*a
f=100kg*5m/s^2
f=500kgm/s^2 or 500N
hope helps you
The Goal: Similar to the first project, this project also uses the random module in Python. The program will first randomly generate a number unknown to the user. The user needs to guess what that number is. (In other words, the user needs to be able to input information.) If the user’s guess is wrong, the program should return some sort of indication as to how wrong (e.g. The number is too high or too low). If the user guesses correctly, a positive indication should appear. You’ll need functions to check if the user input is an actual number, to see the difference between the inputted number and the randomly generated numbers, and to then compare the numbers.• Concepts to keep in mind: • Random function• Variables• Integers• Input/Output• Print• While loops• If/Else statements
Answer:
Here is the Python program:
import random #to generate random numbers
def generateRandNo(): #function to generate random number
randNo = random.randint(1,100) #generates random number in range from 1 to 100
return randNo #returns the generated random number
def userInput(message = "Guess the number "): #to gets integer input from user and return the input number
userGuess = int(input(message)) #store the int type input from user in userGuess variable
return userGuess #returns the user input number
def compareNumbers(userGuess,randNo): #compares the user input with actual randomly generated number
if userGuess > randNo: # if user input is greater than actual number
return "The number is too high"
elif userGuess < randNo: #if user input is less than actual number
return "The number is too low"
else: #if user guess is correct
return "Correct"
def main(): #main method
correct = False #sets correct to False
begin = True #sets start game i.e. begin to True
while correct or begin: #while loop keeps repeating as long as user guess is correct or user wants to start game again
guessCount = 0 #counts number of trials user takes to guess the correct number
randNo = generateRandNo() #generates a random number using generateRandNo
userGuess = userInput() #gets input number from user using userInput method
guessCount+=1 #increments at each guess made by user
message = compareNumbers(userGuess,randNo) #compares user guess input number with actual number
while message != "Correct" : # while message is not equal to Correct
print(message) #prints to guess the number
userGuess = userInput("Try again: ") #keeps asking user to try again and enter a number
guessCount = guessCount + 1 #increments guessCount by 1 at each guess made by user
message = compareNumbers(userGuess,randNo) #compares user input with actual number
print()
print(message,"It took you ",guessCount," attempts to answer\n") #prints how much trials user took to guess correct number
choice = input("Do you wish to continue? (Enter yes or no) ") #asks user if user wants to start over
if choice == 'no': # if user enters no
exit(1) #exits the program
else: #if user enters yes starts the game again
correct = True #sets correct guess to True
main() #calls main method to start the guess game
Explanation:
The program is well explained in the comments attached with each line of the code. Suppose the randomly generated number (actual number) is 50 and user input is 24 then message The number is too low is displayed and if user guess input is 80 then The number is too high is displayed. If the user guesses the correct number i.e. 50 3rd time then the message displayed is:
It took you 3 attempts to answer.
The the user is asked to continue as:
Do you wish to continue? (Enter yes or no)
If user enters no the program exits if yes then user is asked to Guess the number again.
The screenshot of output is attached.
Write a program named palindromefinder.py which takes two files as arguments. The first file is the input file which contains one word per line and the second file is the output file. The output file is created by finding and outputting all the palindromes in the input file. A palindrome is a sequence of characters which reads the same backwards and forwards. For example, the word 'racecar' is a palindrome because if you read it from left to right or right to left the word is the same. Let us further limit our definition of a palindrome to a sequence of characters greater than length 1. A sample input file is provided named words_shuffled. The file contains 235,885 words. You may want to create smaller sample input files before attempting to tackle the 235,885 word sample file. Your program should not take longer than 5 seconds to calculate the output
In Python 3,
MY CODE: palindromefinder.py
import sys
def is_Palindrome(s):
if len(s) > 1 and s == s[::-1]:
return true
else:
return false
def main():
if len(sys.argv) < 2:
print('Not enough arguments. Please provide a file')
exit(1)
file_name = sys.argv[1]
list_of_palindrome = []
with open(file_name, 'r') as file_handle:
for line in file_handle:
lowercase_string = string.lower()
if is_Palindrome(lowercase_string):
list_of_palindrome.append(string)
else:
print(list_of_palindrome)
If you can adjust my code to get program running that would be ideal, but if you need to start from scratch that is fine.
Open your python-3 console and import the following .py file
#necessary to import file
import sys
#define function
def palindrome(s):
return len(s) > 1 and s == s[::-1]
def main():
if len(sys.argv) < 3:
print('Problem reading the file')
exit(1)
file_input = sys.argv[1]
file_output = sys.argv[2]
try:
with open(file_input, 'r') as file open(file_output, 'w') as w:
for raw in file:
raw = raw.strip()
#call function
if palindrome(raw.lower()):
w.write(raw + "\n")
except IOError:
print("error with ", file_input)
if __name__ == '__main__':
main()
Why are floppy disks obsolete ?
Answer:
they don't have enough space on them to carry useful information, and because most computers no longer have a drive for them. This is true for most legacy items
How to get passed administrattor on macbook air to get games and stuff.
Answer:
You need to use the name and password of the main owner of the computer/the account you made when you first got it. Then, you should be able to download apps and use it if you have your apple ID set up.
Explanation:
What are the four components of the Universal Systems Model?
Answer:
output, process, input, and feedback
Explanation:
Lonnie has several workbooks that contain financial and sales data. He needs to ensure that if the data in a single cell in one workbook changes that it is automatically updated and reflected in another workbook. What should Lonnie create?
Answer: Linked cell
Explanation: I just did a test
Answer:
The person above is correct The answer is B:linked cell
Explanation:
Just finished Unit Test Review.
Write a program that takes in a line of text as input, and outputs that line of text in reverse. The program repeats, ending when the user enters "Quit", "quit", or "q" for the line of text.
Ex: If the input is: (see image attached)
my code is this one but i dont know what im doing wrong:
#include
using namespace std;
int main()
{
while (true)
{
string word;
if (word.compare("Quit")==0)
{
break;
}
else if (word.compare("quit")==0)
{
break;
}
int len=word.length();
cout = 0; i--)
{
cout << word[i];
break;
}
cout << endl << endl;
}
cout << "Thank You..!";
return 0;
}
Table of Contents
1 Introduction
2 Running sed
2.1 Overview
2.2 Command-Line Options
2.3 Exit status
3 sed scripts
3.1 sed script overview
3.2 sed commands summary
3.3 The s Command
3.4 Often-Used Commands
3.5 Less Frequently-Used Commands
3.6 Commands for sed gurus
3.7 Commands Specific to GNU sed
3.8 Multiple commands syntax
3.8.1 Commands Requiring a newline
4 Addresses: selecting lines
4.1 Addresses overview
4.2 Selecting lines by numbers
4.3 selecting lines by text matching
4.4 Range Addresses
5 Regular Expressions: selecting text
5.1 Overview of regular expression in sed
5.2 Basic (BRE) and extended (ERE) regular expression
5.3 Overview of basic regular expression syntax
5.4 Overview of extended regular expression syntax
5.5 Character Classes and Bracket Expressions
5.6 regular expression extensions
5.7 Back-references and Subexpressions
5.8 Escape Sequences - specifying special characters
5.8.1 Escaping Precedence
5.9 Multibyte characters and Locale Considerations
5.9.1 Invalid multibyte characters
5.9.2 Upper/Lower case conversion
5.9.3 Multibyte regexp character classes
6 Advanced sed: cycles and buffers
6.1 How sed Works
6.2 Hold and Pattern Buffers
6.3 Multiline techniques - using D,G,H,N,P to process multiple lines
6.4 Branching and Flow Control
6.4.1 Branching and Cycles
6.4.2 Branching example: joining lines
7 Some Sample Scripts
7.1 Joining lines
7.2 Centering Lines
7.3 Increment a Number
7.4 Rename Files to Lower Case
7.5 Print bash Environment
7.6 Reverse Characters of Lines
7.7 Text search across multiple lines
7.8 Line length adjustment
7.9 Reverse Lines of Files
7.10 Numbering Lines
7.11 Numbering Non-blank Lines
7.12 Counting Characters
7.13 Counting Words
7.14 Counting Lines
7.15 Printing the First Lines
7.16 Printing the Last Lines
7.17 Make Duplicate Lines Unique
7.18 Print Duplicated Lines of Input
7.19 Remove All Duplicated Lines
7.20 Squeezing Blank Lines
8 GNU sed’s Limitations and Non-limitations
9 Other Resources for Learning About sed
10 Reporting Bugs
Appendix A GNU Free Documentation License
Concept Index
Command and Option Index
Next: Introduction, Up: (dir) [Contents][Index]
GNU sed
This file documents version 4.8 of GNU sed, a stream editor.
Copyright © 1998–2020 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License”.
• Introduction: Introduction
• Invoking sed: Invocation
• sed scripts: sed scripts
• sed addresses: Addresses: selecting lines
• sed regular expressions:
Explanation:
Create a class named FormLetterWriter that includes two overloaded methods named displaySalutation(). The first method takes one String parameter that represents a customer's last name, it displays the salutation "Dear Mr. or Ms." followed by the last name. The second method accepts two String parameters that represent a first and last name, and it displays the greeting "Dear" followed by the first name, a space, and the last name. After each salutation, display the rest of a short business letter: "Thank you for your recent order." Write a main() method that tests each overloaded method. Save the file as FormLetterWriter.java.
Answer:
Follows are the code to this question:
public class FormLetterWriter//defining class
{
static void displaySalutation(String last_Name)//defining a method displaySalutation
{
System.out.println("Dear Mr. or Ms. " + last_Name);//print value
}
static void displaySalutation(String first_Name, String last_Name) //overload the method displaySalutation
{
System.out.println("Dear " + first_Name + " " + last_Name);//print value
}
public static void message()//defining a method message
{
System.out.println("Thank you for your recent order.");//print message
}
public static void main(String[] args) //defining main method
{
displaySalutation("I Kell");//calling a method displaySalutation by passing a single String value
message();//calling message method
displaySalutation("Christ", "John");//calling a method displaySalutation by passing a two String value
message();//calling message method
}
}
Output:
please find the attached file.
Explanation:
In the above given program a calss "FormLetterWriter" is defined, in side the class we perform the method overloading, in which a method "displaySalutation" is used in first definition it accepts a single string variable "first_Name", and in second time, it accept two string variable " first_Name and last_Name".
Inside the both method, we use print method, that print its value, and an onther method message is defined, that print the given message.
In the class main method is declared, in which we apply mathod overloading and also call the message method for print the given business letter.
A program is written to compute the sum of the integers from 1 to 10. The programmer, well trained in reusability and maintainability, writes the program so that it computes the sum of the numbers from k to n. However, a team of security specialists scrutinizes the code. The team certifies that this program properly sets k to 1 and n to 10; therefore, the program is certified as being properly restricted in that it always operates on precisely the range 1 to 10.
Required:
List different ways that this program can be sabotaged so that during execution it computes a different sum, such as 3 to 20.
Answer:
See explanation
Explanation:
An instance of such program written in python is
isum = 0
for i in range(1,11):
isum = isum + i
print(sum)
One of the ways the program can give a wrong result is when someone alters the program source program before it's complied and executed.
Take for instance.
Changing
isum = 0 to isum = 4
will alter the result by additional 4
Another way is if an outside program or process alters the program execution.
A secure biometrics system authenticates the user based on his/her physiological (e.g., fingerprint, face, voice) or behavioral (e.g., gait, hand gesture, keystroke) traits. Typically, a binary classification model will be developed to generate predicted probabilities based on the input information. Please explain:
Answer:
The solution to this question can be defined as follows:
Explanation:
please find the complete question in the attached file:
In point a:
It utilizes multiple algorithms based on machine learning can understand the attributes or transform their probability into projections. Its algorithms could be used, including such neural computer systems or artificial neural networks. Whenever the input, as well as the target outcome, are taken their possibilities are converted in forecasts, so that if the input, as well as the corresponding results, are balanced.
In point b:
The operating curves of its receiver is indeed a plot of its true positives for its incorrect positive rate. It could be used in different tests for treatment. It indicates the variations of its responsiveness between all the two components and also the accuracy. Line slopes supply LR with a value.
C++
12.18 Lab - Structs
In this lab, you will familiarize yourself with structs through a small exercise. We will be mixing the RGB values of colors together to make a new one.
RGB stands for red, green and blue. Each element describes the intensity value ranging from 0 - 255. For example: black color will have RGB values (0, 0, 0) while white will have (255, 255, 255).
Create an array of structs color. The struct contains three integers named red, green and blue. This corresponds to the RGB values of a color. For each array element, ask the user to enter the intensity value of red, green and blue. The value should be between 0 and 255 (inclusive).
*********The user can enter at most 10 colors. ********. see below for inputs
Additionally, compute the average of each of the red, green and blue components. For code modularity, implement a function that returns the average of each rgb component in your dynamic array. The function (called average) should take in a struct array, the rgb type for which you want to compute the average (as a string - red, blue or green) and its length. Print out the final result in the form (r, g, b), where r, g, b corresponds to each averaged value.
Can you guess what color you mixed? (Note: Your program does not need to print the final color mixed)
TEST #1
Input ------->>> 0 0 2 2 4 2
Expected output ----->>>> (1, 2, 2)
TEST #2
Input ------>>> 245 220 5 43 56 21 234 56 43
Expected output ----->>>> (174, 110, 23)
TEST #3
Input ------->>> 225 221 2 43 56 21 224 56 43 120 110 24 25 25 27
Expected output ----->>>> (127, 93, 23)
TEST #4
Input -------->>> 245 22 34
Expected output ----->>>> (245, 22, 34)
In order to input values choose between 0 up till 255 (integers)
Output
Number of colors to be analized: 2
Write the amounts of RGB: 1:
Red: 10
Green: 20
Blue: 100
Write the amounts of RGB: 2:
Red: 30
Green: 20
Blue: 19
The colors average: (20, 20, 59)
...Program finished with exit code 0
Press ENTER to exit console.
Code
#include <iostream>
using namespace std;
//declaration of variables
typedef struct Color {
int b,r,g; //integers values which define a digital color
} Color;
//function of average
int average(Color *colors, int size, char type) {
int s = 0;
for(int i=0; i<size; i++) {
if(type=='b') {
s += colors[i].b;
}
if(type=='g') {
s += colors[i].g;
}
if(type=='r') {
s += colors[i].r;
}
}
return s/size;
}
int main() {
int n;
cout << "Number of colors to be analized: ";
cin >> n;
Color *colors = new Color[n];
for(int i=0; i<n; i++) {
cout << "Write the amounts of RGB: " << (i+1) << ":\n";
cout << "Red: ";
cin >> colors[i].r;
cout << "Green: ";
cin >> colors[i].g;
cout << "Blue: ";
cin >> colors[i].b;
cout << endl;
}
cout << "The colors average: ";
cout << "(" << average(colors, n, 'r') << ", " << average(colors, n, 'g');
cout << ", " << average(colors, n, 'b') << ")\n";
}
Lola is friends with a boy she chats with in an online video game. Lola only knows the boy by his screen name and avatar. He only knows her in the same way. Lola is careful to make good choices when talking to someone online, even someone she thinks she knows well. The boy asks her the following questions in a recent chat room meet-up. Which questions should she not answer?
a
What kind of music do you listen to?
b
What is your favorite subject?
c
What is your realname?
d
Will you promise to keep our friendship a secret?
Answer:
I think the answer should be d.
#include
using namespace std;
const int SIZE = 4;
bool isSorted(const int arr[], int size);
bool isNonDecreasing(const int arr[], int size);
bool isNonIncreasing(const int arr[], int size);
void printArr(const int arr[], int size);
int main()
{
int test1[] = { 4, 7, 10, 69 };
int test2[] = { 10, 9, 7, 3 };
int test3[] = { 19, 12, 23, 7 };
int test4[] = { 5, 5, 5, 5 };
if (!isSorted(test1, SIZE))
cout << "NOT ";
cout << "SORTED" << endl;
printArr(test1, SIZE);
if (!isSorted(test2, SIZE))
cout << "NOT ";
cout << "SORTED" << endl;
printArr(test2, SIZE);
if (!isSorted(test3, SIZE))
cout << "NOT ";
cout << "SORTED" << endl;
printArr(test3, SIZE);
if (!isSorted(test4, SIZE))
cout << "NOT ";
cout << "SORTED" << endl;
printArr(test4, SIZE);
return 0;
}
bool isSorted(const int arr[], int size)
{
// TODO: This function returns true if the array is sorted. It could be
// sorted in either non-increasing (descending) or non-decreasing (ascending)
// order. If the array is not sorted, this function returns false.
// HINT: Notice that the functions isNonDecreasing and isNonIncreasing are not
// called from main. Call the isNonDecreasing and isNonIncreasing functions here.
}
bool isNonDecreasing(const int arr[], int size)
{
// TODO: Loop through the array to check whether it is sorted in
// non-decreasing (in other words, ascending) order. If the array
// is non-decreasing, return true. Otherwise, return false.
}
bool isNonIncreasing(const int arr[], int size)
{
// TODO: Loop through the array to check whether it is sorted in
// non-increasing (in other words, descending) order. If the array
// is non-increasing, return true. Otherwise, return false.
}
void printArr(const int arr[], int size)
{
for (int i = 0; i < size; i++)
cout << arr[i] << " ";
cout << endl << endl;
}
Output
SORTED
4 7 10 69
SORTED
10 9 7 3
NOT SORTED
19 12 23 7
SORTED
5 5 5 5
Code
//The added part is in the bottom
#include <iostream>
using namespace std;
const int SIZE = 4;
bool isSorted (const int arr[], int size);
bool isNonDecreasing (const int arr[], int size);
bool isNonIncreasing (const int arr[], int size);
void printArr (const int arr[], int size);
int
main ()
{
int test1[] = { 4, 7, 10, 69 };
int test2[] = { 10, 9, 7, 3 };
int test3[] = { 19, 12, 23, 7 };
int test4[] = { 5, 5, 5, 5 };
if (!isSorted (test1, SIZE))
cout << "NOT ";
cout << "SORTED" << endl;
printArr (test1, SIZE);
if (!isSorted (test2, SIZE))
cout << "NOT ";
cout << "SORTED" << endl;
printArr (test2, SIZE);
if (!isSorted (test3, SIZE))
cout << "NOT ";
cout << "SORTED" << endl;
printArr (test3, SIZE);
if (!isSorted (test4, SIZE))
cout << "NOT ";
cout << "SORTED" << endl;
printArr (test4, SIZE);
return 0;
}
bool
isSorted (const int arr[], int size)
{
//Added part
if (isNonDecreasing (arr, size) || isNonIncreasing (arr, size))
{
return true;
}
else
{
return false;
}
}
bool
isNonDecreasing (const int arr[], int size)
{
for (int i = 0; i < (size - 1); i++)
{
if (arr[i] > arr[i + 1]) //It compares the n value with the n-1 value and output
{
return false;
break;
}
}
return true;
}
bool
isNonIncreasing (const int arr[], int size)
{
for (int i = 0; i < (size - 1); i++)
{
if (arr[i] < arr[i + 1]) //It compares the n value with the n-1 value and output reautilization of previous function by replacing only “<”
{
return false;
break;
}
}
return true;
}
void
printArr (const int arr[], int size)
{
for (int i = 0; i < size; i++)
cout << arr[i] << " ";
cout << endl << endl;
}
Select the correct statement(s) regarding digital baseband modulation.
a. similar to analog signal modulation, logical ""1s"" and ""0s"" are represented by carrier wave amplitudes, frequencies, or phase angles
b. QAM is a modulation technique in which both carrier amplitude and phase angle changes represent logical data
c. with QAM, two carrier waves of the same frequency, but separated by π/2 radians, are used to represent logical data
d. all statements are correct
Answer:
The answer is "Option d".
Explanation:
The electronic firmware synchronization was its method where even the series of bytes is amplified even before the transmission process into to the sound waves and, thus, and in conceptual "1s" and "0s" represented by large font, wavelengths, or switching frequency.
QAM utilizes both magnitudes of the transporter and adjustments in the phase shift. Rational data is represented by [tex]\frac{\pi}{2}[/tex] cartesian coordinates for both the carries waves of the same wavelengths and represents the result in total.what can you say about the age of oceanic crust near and far from the mid oceanic rdge
Answer:
The closer crust at the Mid Atlantic Ridge is newer, and the farther the crust is older.
Explanation:
The Mid Atlantic Ridge produces new crust, and pushes away older crust, which means the farther away the older.
14. Convert 11110111 from binary to denary
(1 Point)
converting 11110111 from binary to denary = 247
Answer:
247
Explanation:
Which of the following is a post-secondary school?
A.
Community college
B.
Vocational school
C.
Four-year college
D.
All of the above
Answer:
D
Explanation:
Answer:
C.
Four-year college
Explanation:
HELP!!
Why is email etiquette important? (1 point)
Email is rarely used to communicate via technology.
With more and more written communication through technology, it is important to sound competent and qualified and for your meaning to be clear.
Not many classes are taken online.
Even though companies and employers use a lot of email communication, they don't really care if you are clear with your communication
Answer:
B
Explanation: