Questions
Write a program that prompts the user enter a word, and determines the first half and...

  1. Write a program that prompts the user enter a word, and determines the first half and second half of the word. Print the first and second half of the word on different lines. Sample runs of the program are shown below. Note: If the word is an odd number of letters, the first half should contain fewer letters (as shown in sample run #2)

SAMPLE PROGRAM RUN #1                    

Enter a word: carrot

First half: car

Second half: rot

SAMPLE PROGRAM RUN #2                            

Enter a word: plant

First half: pl

Second half: ant

Complete your answer by typing code below

import java.util.Scanner;

public class WordHalves

{

public static void main(String[] args)

{

Scanner reader = new Scanner(System.in);

System.out.print("Enter a word: ");

String word = reader.nextLine();

}

}

In: Computer Science

Describe the similarities between using recursion versus iteration. Describe the difference between using recursion versus iteration.

  1. Describe the similarities between using recursion versus iteration.
  2. Describe the difference between using recursion versus iteration.

In: Computer Science

A. Define and implement the class Alarm as follows: The class Alarm consists of two private...

A. Define and implement the class Alarm as follows: The class Alarm consists of two private member variables: description of type string and atime of type Time. The class Alarm also includes the following public member functions:

1. print to print out the alarm’s description and hour, minute, and second of the alarm time.

2. setDescription to accept a string argument and use it to set the description member variable.

3. setAtime to accept three integers (for hour, minute, and second) to set the atime member variable (alarm time).

4. getDescription to return the value of the description member variable.

5. getAtime to return the atime member as a Time object.

6. A default constructor that initializes the description to the string “None” and the alarm time to 00:00:00.

7. An overloaded constructor that accepts a string argument for the alarm description and three int arguments (as the hour, minute, and second) and use them to initialize the description and atime member variables of an Alarm object.

8. An overloaded constructor that accepts a string argument for the alarm description and a Time object and use them to initialize the description and atime member variables of an Alarm object. 9. An equals function to compare two Alarm objects’ values. Return true if both objects have the same values of the member variables. Otherwise, return false. B. In the function main, write statements to declare Alarm class objects and test your class implementation.

Your project is expected to contain five source files: Time.h, Time.cpp, Alarm.h, Alarm.cpp, Lab8.cpp.

In: Computer Science

Output and Debugging Questions (10 marks each) [20 Marks] Note: Provide a copy of the code...

Output and Debugging Questions (10 marks each) [20 Marks]
Note: Provide a copy of the code and screen shot for the output in the solutions’
1. Trace the following program and write the exact output for the following inputs.
Explain each output. [10 Marks]
a. Input of an array { 20, 80 , 63, 89 }
b. Input of an array { 1, 2 ,3, 4}
c. Input of an array { 100, 200 ,300, 400}
d. Input of an array { -8, -9, -10, -11} ( Negative numbers)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
int[] M = new int[4] ;
for (int i = 0; i <4; i++)
{
M[i] = Int32.Parse(Console.ReadLine());
}
for (int i = 0; i < M.Length; i++)
{
M[i] = M[i] + 10;
Console.Write((M[i] / 3) + " ");

}
Console.ReadKey();
}
}
}

In: Computer Science

6) Create the following in a Java Program: Create payroll system Prompt the user to enter...

6) Create the following in a Java Program:


Create payroll system
Prompt the user to enter payroll information
Employee name and create variable for scanner
Hours worked
Hourly pay rate
Federal tax rate
State tax rate
Declare variable doubles for gross pay, federal, state and total deduction

Display payroll statement example:
Name of employee
Hours worked
Hourly pay rate
Gross pay which is equal hours worked multiply hourly pay rate
Federal withholding which is equal of gross pay multiply federal tax rate
State withholdings which is equal of gross pay multiply by state tax rate
Total deduction which is equal of federal + state
Net pay which where gross pay is minus total deduction

In: Computer Science

Please discuss the difference between Web 2.0 and Web 3.0 with the references. About 300-500 words

Please discuss the difference between Web 2.0 and Web 3.0 with the references.

About 300-500 words

In: Computer Science

prepare a 300-500 word document answering the following questions: Applying theories form this course, how may...

prepare a 300-500 word document answering the following questions:

  • Applying theories form this course, how may a remote working increase security risks?
  • Does remote work increase or decrease physical security risks?
  • Research current news topics on COVID-19 impacts on Cybersecurity and answer the following question:
    • What are the greatest vulnerabilities (per the articles you find - you must cite your sources) that are a result of COVID-19 response?

In: Computer Science

3. write a program that uses a class called "garment" that is derived from the class...

3. write a program that uses a class called "garment" that is derived from the class "fabric" and display some values of measurement. 20 pts.

Based on write a program that uses the class "fabric" to display the square footage of a piece of large fabric.
  
       class fabric
           {
               private:
                   int length;
                   int width;
                   int squareFoot;
               public:
                   int area();
           }

In: Computer Science

7) Create the following using Java. Create a scanner Declare double variables for price and tax...

7) Create the following using Java.

Create a scanner
Declare double variables for price and tax
Declare character variable reply

Create do while loop
Inside of do loop
Prompt the console to display headline Product Price Check
Prompt the user to enter initial price and relate to scanner
Prompt the user to enter the tax rate and relate to scanner
Calculate price which is equal to price multiply (1+tax/100)
Display in console the cost after tax which is price

Check if user want to enter another product by (y/n)?
Declare replay equal to scanner .next.charAt(0)

In: Computer Science

Implement a program as an object using a class (abstract data type) in C++ that does...

Implement a program as an object using a class (abstract data type) in C++ that does the following:

1) reads the firstName, lastName and 3 test scores of at least five students.

2) calculate student test score totals, average, letter grade for each student.

3) Display the results in a table format showing firstName, lastName, test1, test2, test3, total, average, letterGrade, of all the students.

3 files .h, .cpp, main.cpp

create an object that can hold records.

must get records from a file.

output must be table format

Mickey Mouse 100 90 80 70

Minnie Mouse 95 100 75 85

Daffy Duck 50 60 70 80

Daisy Duck 100 95 90 80

Tom Jerry 90 100 85 80

In: Computer Science

8) Create the following program using Java. Circle calculation using methods Create scanner declare double variable...

8) Create the following program using Java.

Circle calculation using methods

Create scanner
declare double variable radius = -999
declare character choice

create do while loop
inside of do loop write:
System.out.println();
System.out.println("*** CIRCLE CALCULATIONS ***");
System.out.println();
System.out.println("1. Enter the radius of the circle");
System.out.println("2. Display the area of the circle");
System.out.println("3. Display the circumference of the circle");
System.out.println("4. Quit");
System.out.println();
System.out.println("Enter a number from 1 - 4");
System.out.println();


Declare choice character and relate to scanner

declare switch (choice)

case 1 radius which is equal to option1 method

case 2 call option2(radius)

case 3 call option3(radius)

case 4 quit

default
prompt the user to enter numbers from 1 - 4
close bracket
while condition choice !='4'

create method static double option1 gets the user to enter the radius of the circle
declare myradius variable double
declare a scanner
prompt the user to enter the radius of circle and relate to variable above with scaner
return the variable

create method static void option2 with parameter double radiusin
check condition id radiusin is equal to -999 display the message in console no radius is entered

else

declare variable double area
area is equal to 3.14 * radiusin * radiusin
display in console the area


create method static void option3 with parameter double radiusin
check condition id radiusin is equal to -999 display the message in console no radius is entered

else

declare variable double circumference
circumference is equal to 2 * 3.14 * radiusin
display in console the circumference

In: Computer Science

Program Name: Divisible. Write a program that calculates the number of integers in a range from...

Program Name: Divisible. Write a program that calculates the number of integers in a range from 1 to some user-specified upper bound that are divisible by 3, the sum of those integers, and the number and sum of those integers not divisible by 3. Your program must display meaningful output which includes: the selected upper bound number of integers divisible by 3 sum of integers divisible by 3 number of integers not divisible by 3 sum of integers not divisible by 3

IN JAVA USING A WHILE LOOP

In: Computer Science

write a bash shell program named L1 as follows . L1 expects exactly 2 command line...

write a bash shell program named L1 as follows . L1 expects exactly 2 command line arguments. expects $1 to contain only digits. expects $2 to have exactly 4 characters (can be any character).

if NOT exactly 2 command line arguments, echo "need 2 args " and exit.

otherwise, if $1 and/or $2 have incorrect value(s) (as above), echo "bad argX", where X is the first incorrect argument, and exit.

otherwise, echo "good ". you can use echo,grep, pipe to check if the argument have the required characters.

example:

>L1 849474 0-=~

good

>L1 47347 8x

bad arg2

>L1 123abc 8d

bad arg1

In: Computer Science

Triplicates. Given three lists of N names each, devise a linearithmic algorithm to determine if there...

Triplicates. Given three lists of N names each, devise a linearithmic algorithm to determine if there is any name common to all three lists, and if so, return the first such name

In: Computer Science

9) Create a java programming where you will enter two numbers and create only one method,...

9) Create a java programming where you will enter two numbers and create only one method, which will return or display
addition, substraction, multiplication, division, average and check which number is greater than the other.
Everything in one method and call it in main method.

In: Computer Science