Question

In: Computer Science

1.Write complete programs. These programs should be able to compile and run. No psuedocode is allowed....

1.Write complete programs. These programs should be able to compile and run. No psuedocode is allowed. No comments are needed. These programs will be graded for syntax, semantics, and programming style.

Write a complete program to display the following output:
Plan to be
spontaneous tomorrow.

2.

Write complete programs. These programs should be able to compile and run. No psuedocode is allowed. No comments are needed. These programs will be graded for syntax, semantics, and programming style.

Write a complete program to display the results for the area of a triangle. Formula (1/2) x base x height.  

Solutions

Expert Solution

public class Main
{
        public static void main(String[] args) {
        //declaring a string
        String str1="Plan to be";
        String str2="spontaneous tomorrow.";

        //display ouptut
                System.out.println(str1);
                System.out.println(str2);
        }
}

import java.util.*;
public class Main
{
        public static void main(String[] args) {
            Scanner s=new Scanner(System.in);
            double b,h,area;
                System.out.println("enter base and height values:");
                b=s.nextDouble();
                h=s.nextDouble();
                area=0.5*b*h;
                System.out.println("area of a triangle is : "+area);
        }
}


Related Solutions

Write a complete program (possible to compile) that: 1) declares two local integers x and y...
Write a complete program (possible to compile) that: 1) declares two local integers x and y 2) defines a global structure containing two pointers (xptr,yptr) and an integer (z) 3) Declares a variable (mst) by the type of previous structure 4) requests the values of x and y from the user using only one scanf statement 5) sets the first pointer in the struct to point to x 6) sets the second pointer in the struct to point to y...
write the PsuedoCode and the flow chart of the following: 1. draw a deck of cards...
write the PsuedoCode and the flow chart of the following: 1. draw a deck of cards from a standard deck of 52 cards until the queen of hearts is draw. how many cards did you draw?
6. Write a program in C programming (compile and run), a pseudocode, and draw a flowchart...
6. Write a program in C programming (compile and run), a pseudocode, and draw a flowchart for each of the following problems: a) Obtain three numbers from the keyboard, compute their product and display the result. b) Obtain two numbers from the keyboard, and determine and display which (if either) is the smaller of the two numbers. c) Obtain a series of positive numbers from the keyboard, and determine and display their average (with 4 decimal points). Assume that the...
SML Complete the following programs. 1. Write a function listify that takes a list and returns...
SML Complete the following programs. 1. Write a function listify that takes a list and returns a list of lists where each element of first list becoming its own single-element list (Fill in the code here) fun main() = let val lst = (explode "rad"); in print (PolyML.makestring ( listify lst )) end; 2. Write a function splitlist that takes a list of pairs and returns a pair of lists that has the firsts of the pairs in one list...
find all the errors c++ should be able to be compiled and run to perform the...
find all the errors c++ should be able to be compiled and run to perform the task #include iostream #include <string> Using namespace std; class Customer { // Constructor void Customer(string name, string address) : cust_name(name), cust_address(address) { acct_number = this.getNextAcctNumber(); } // Accessor to get the account number const int getAcctNumber() { return acct_number; } // Accessor to get the customer name string getCustName(} const { return cust_name; } // Accessor to get the customer address string getCustAddress() const...
) Use functions and arrays to complete the following programs. Requirements: • You should use the...
) Use functions and arrays to complete the following programs. Requirements: • You should use the divide-and-conquer strategy and write multiple functions. • You should always use arrays for the data sequences. • You should always use const int to define the sizes of your arrays. a. Write a C++ program. The program first asks the user to enter 4 numbers to form Sequence 1. Then the program asks the user to enter 8 numbers to form Sequence 2. Finally,...
**NO PAPER ANSWERS. ALL ANSWER SUBMISSIONS SHOULD BE ABLE TO RUN WITH NO ERRORS** **TO CREATE...
**NO PAPER ANSWERS. ALL ANSWER SUBMISSIONS SHOULD BE ABLE TO RUN WITH NO ERRORS** **TO CREATE THIS JAVA PROGRAM USE ECLIPSE NEON** The assignment is as follows: Connect four is a two-player board game in which the players alternately drop colored disks into a seven-column, six-row vertically-suspended grid. The objective of the game is to connect four same-colored disks in a row, a column, or a diagonal before your opponent can do likewise. The program prompts a player to drop...
1. compile and try to run broken.c 2. use the gdb debugger to try to find...
1. compile and try to run broken.c 2. use the gdb debugger to try to find where the seg fault occurs 3. after a bit of detective work with the use of gdb, answer the questions in the file questions.txt 4. fix the error(s) in broken.c ****broken.c***** /* This program creates an array containing 10 integers and then at the bottom checks to see if the number 11 is in the array. Note: the program contains a bug that only...
Governments should be allowed to run up large amounts of government debt in tackling the COVID-19...
Governments should be allowed to run up large amounts of government debt in tackling the COVID-19 crisis. Please use the example of UK to critically comment on this statement. (250 words)
1. A firm should ________ in the short run and ________ in the long run if...
1. A firm should ________ in the short run and ________ in the long run if it cannot cover its variable costs. shut down; leave the industry shut down; decrease output decrease output; leave the industry decrease output; decrease output 2. Differentiated products may be sold in which of the following? Monopolistic competition and oligopoly Perfect competition and monopolistic competition Monopoly and oligopoly Oligopoly and perfect competition
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT