Questions
Write a Python function which finds the smallest even and odd numbers in a given list....

Write a Python function which finds the smallest even and odd numbers in a given list. (Use for loop and if conditions for this problem)

In: Computer Science

I have a dictionary of phone numbers in a .csv file. There are multiple formats xxx-xxx-xxxx,...

I have a dictionary of phone numbers in a .csv file. There are multiple formats xxx-xxx-xxxx, xxxxxxxxxx, and (xxx) xxx-xxxx. I want to clean them up into one standard format in python.

In: Computer Science

Let G(V, E,w) be a weighted undirected graph, where V is the set of vertices, E...

Let G(V, E,w) be a weighted undirected graph, where V is the set of vertices, E is the set of edges, and w : E → R + is the weight of the edges (R + is the set of real positive numbers). Suppose T(G) is the set of all minimum spanning trees of G and is non-empty. If we know that the weight function w is a injection, i.e., no two edges in G have the same weight, then:

a) How many elements would T(G) has? Please support your answer to the above question with a proof.

In: Computer Science

* Write a program texttriangle.py. in python This, too, is not a graphics program. Prompt the...

* Write a program texttriangle.py. in python

This, too, is not a graphics program. Prompt the user for a small positive integer value, that I’ll call n. Then use a for-loop with a range function call to make a triangular arrangement of ‘#’characters, with n ‘#’ characters in the last line. Hint: [5]

Then leave a blank line. Then make a similar triangle, except start with the line with n ‘#’ characters. To make the second triangle, you can use a for-loop of the form discussed so far, but that is trickier than looking ahead to The Most General range Function and using a for-loop where a range function call has a negative step size.

In: Computer Science

Write ALL POSSIBLE outputs from the following multithreaded program (10pts). Explain your reasons (10pts).     class...

Write ALL POSSIBLE outputs from the following multithreaded program (10pts). Explain your reasons (10pts).    

class Sum{

private int sum;
public int getSum(){

return sum;
}
public void setSum(int sum){

this.sum = sum;
}
}

class Summation implements Runnable{

private int start;
private int end;
private Sum sumValue;

public Summation(int start, int end, Sum sumValue) {

this.start = start;
this.end = end;
this.sumValue = sumValue;
}

public void run(){

int sum = 0;
for(int i=start; i<=end;i++)
sum += i;
sumValue.setSum(sum);
System.out.println(" sum from " + start + " to "+ end + " is " + sum);
}
}

public class Test{

public static void main(String[] args){
int sum_total=0;
int upper=10;
Sum sumObject1=new Sum();
Sum sumObject2=new Sum();

Thread thrd1=new Thread(new Summation(1,upper/2-1,sumObject1));
Thread thrd2=new Thread(new Summation(upper/2,upper,sumObject2));

thrd1.start();
thrd2.start();
try{

thrd1.join();
thrd2.join();
sum_total=sumObject1.getSum() + sumObject2.getSum();
System.out.println("the result is " + sum_total);
}catch (InterruptedException ie) {}
}
}

In: Computer Science

i) Pen down the algorithm for Radix sort. ii) What is the complexity of Radix sort?...

i) Pen down the algorithm for Radix sort.

ii) What is the complexity of Radix sort?

iii) Give any 2 real time examples of Radix sort.

In: Computer Science

Please create the SQL queries using the lryics database under question 4 and use "select *...

Please create the SQL queries using the lryics database under question 4 and use "select * from..." after each query to show the effects of your data manipulation query. Thanks for help

1. The title 'Time Flies' now has a new track, the 11th track 'Spring', which is 150 seconds long and has only a MP3 file. Insert the new track into Tracks table (Don’t hand-code any data for insert that can be looked up from the Titles table).

2. Create a new table called Members2 with the same fields as the Members table. (Use DESCRIBE to check if Members2 table is created).

3. Populate Members2 with the content of the Members table.

4. The area code for Columbus, Ohio (OH) has been changed from 277 to 899. Update the homephone and workphone numbers of all members in Members2 table accordingly.

DROP TABLES IF EXISTS Artists,Genre, Members, Titles, Tracks,SalesPeople,Studios,XrefArtistsMembers;
DROP TABLES IF EXISTS Authors,Publishers,Titles,Title_Authors,Royalties;
DROP TABLES IF EXISTS Products,Customers,Orders,Order_details;
DROP TABLES IF EXISTS Sailors,Boats,Reserves;

CREATE TABLE Artists (
        ArtistID int, 
        ArtistName varchar (50) NOT NULL ,
        City varchar (25) NULL ,
        Region varchar (15) NULL ,
        Country varchar (20) NULL ,
        WebAddress varchar (40) NULL ,
        EntryDate date NULL ,
        LeadSource varchar (10) NULL 
);

Insert Into Artists Values(1,'The Neurotics','Peterson','NC','USA','www.theneurotics.com','2003-05-14','Directmail');
Insert Into Artists Values(2,'Louis Holiday','Clinton','IL','USA' ,NULL,'2003-06-03','Directmail');
Insert Into Artists Values(3,'Word','Anderson','IN','USA',NULL,'2003-06-08','Email');
Insert Into Artists Values(5,'Sonata','Alexandria','VA','USA','www.classical.com/sonata','2003-06-08','Ad');
Insert Into Artists Values(10,'The Bullets','Alverez','TX','USA',NULL,'2003-08-10','Email');
Insert Into Artists Values(14,'Jose MacArthur','Santa Rosa','CA','USA','www.josemacarthur.com','2003-08-17','Ad');
Insert Into Artists Values(15,'Confused','Tybee Island','GA','USA',Null,'2003-09-14','Directmail');
Insert Into Artists Values(17,'The Kicks','New Rochelle','NY','USA',NULL,'2003-12-03','Ad');
Insert Into Artists Values(16,'Today','London','ONT','Canada','www.today.com','2003-10-07','Email');
Insert Into Artists Values(18,'21 West Elm','Alamaba','VT','USA','www.21westelm.com','2003-02-05','Ad');
Insert Into Artists Values(11,'Highlander','Columbus','OH','USA',NULL,'2002-08-10','Email');

CREATE TABLE Genre (
        Genre varchar (15)  
);

Insert into Genre Values('alternative');
Insert into Genre Values('classical');
Insert into Genre Values('jazz');
Insert into Genre Values('metal');
Insert into Genre Values('R&B');
Insert into Genre Values('rap');
Insert into Genre Values('pop');

CREATE TABLE Members (
        MemberID int ,
        FirstName varchar (25) NULL ,
        LastName varchar (25) NULL ,
        Address varchar (60) NULL ,
        City varchar (25) NULL ,
        Region varchar (15) NULL ,
        PostalCode varchar (10) NULL ,
        Country varchar (20) NULL ,
        HomePhone varchar (16) NULL ,
        WorkPhone varchar (16) NULL ,
        EMail varchar (40) NULL ,
        Gender char (1) NULL ,
        Birthday date NULL ,
        SalesID smallint NULL 
);

Insert Into Members Values(10,'Roberto','Alvarez','Rt 1','Anderson','IN','46019','USA','7651552983','7651628837','[email protected]','M','1968-01-18',2);
Insert Into Members Values(31,'Jose','MacArthur','51444 Vine','Santa Rosa','CA','99999','USA','6331289393',Null,'[email protected]','M','1978-06-24',1);
Insert Into Members Values(13,'Mary','Chrisman','1772 East 117th','Fishers','IN','46123','USA','3171820387',Null,'[email protected]','F','1973-03-01',1);
Insert Into Members Values(15,'Warren','Boyer','167 Alamo Dr','Alverez','TX','75601','USA','8221722883',Null,'[email protected]','M','1969-04-19',2);
Insert Into Members Values(32,'Doug','Finney','2020 Dubois','Savannah','GA','30003','USA','9821222929',Null,'[email protected]','M','1963-08-04',3);
Insert Into Members Values(19,'Terry','Irving','18a 7th St','Tybee Island','GA','30004','USA','5411252093',Null,Null,'M','1959-06-22',3);
Insert Into Members Values(21,'Michelle','Henderson','201 Bonaventure','Savannah','GA','30005','USA','8221928273',Null,Null,'F','1964-03-15',2);
Insert Into Members Values(34,'William','Morrow','PO Box 1882','New Rochelle','NY','10014','USA','9981722928',Null,'[email protected]','M','1965-03-17',2);
Insert Into Members Values(29,'Frank','Payne','5412 Clinton','New Rochelle','NY','10014','USA','9981737464',Null,Null,'M','1960-01-17',1);
Insert Into Members Values(35,'Aiden','Franks','167 East 38th','Alverez','TX','75601','USA','8321729283','8321723833','[email protected]','M','1983-09-02',2);
Insert Into Members Values(3,'Bryce','Sanders','PO Box 1292','Peterson','NC','27104','USA','6441824283',Null,'[email protected]','M','1966-06-11',2);
Insert Into Members Values(14,'Carol','Wanner','787 Airport Rd','Alverez','TX','75601','USA','6831223944',Null,Null,'F','1978-11-08',3);
Insert Into Members Values(33,'Brian','Ranier','23 Gregory Lane','London','ONT','M6Y 2Y7 ','Canada','6231842933',Null,Null,'M','1957-10-19',3);
Insert Into Members Values(7,'Marcellin','Lambert','142 Sample Rd','Alexandria','VA','20102','USA','8331929302',Null,'[email protected]','M','1959-11-14',3);
Insert Into Members Values(8,'Caroline','Kale','1515 Stone Church Rd','Allen','VA','20321','USA','7321223742',Null,Null,'F','1956-05-30',3);
Insert Into Members Values(9,'Kerry','Fernandez','15 Midway','Lynchberg','VA','21223','USA','2211229384','2211223939',Null,'M','1962-01-16',1);
Insert Into Members Values(26,'Tony','Wong','115 Maple St','McKensie','ONT','M8H 3T1','Canada','3311692832','3311692822','[email protected]','M','1955-11-01',2);
Insert Into Members Values(18,'Bonnie','Taft','RR4','Alamaba','VT','05303','USA','3721223292',Null,'[email protected]','F','1960-09-21',1);
Insert Into Members Values(20,'Louis','Holiday','15 Davis Ct','Clinton','IL','63882','USA','1451223838',Null,Null,'M','1969-07-27',2);
Insert Into Members Values(22,'Bobby','Crum','RR2','Pine','VT','05412','USA','1831828211',Null,Null,'M','1965-06-10',3);
Insert Into Members Values(28,'Vic','Cleaver','100 Maple','Reston','VT','05544','USA','8111839292',Null,Null,'M','1957-02-10',2);
Insert Into Members Values(30,'Roberto','Goe','14 Gray Rd','Columbus','OH','48110','USA','2771123943',Null,Null,'M','1967-09-12',1);
Insert Into Members Values(36,'Davis','Goodman','2020 Country Rd','Columbus','OH','48318','USA','2771152882','2771128833','[email protected]','M','1980-10-27',2);


CREATE TABLE SalesPeople (
        SalesID smallint ,
        FirstName varchar (20) NOT NULL ,
        LastName varchar (20) NOT NULL ,
        Initials varchar (3) NULL ,
        Base decimal(5,2) NULL,
        Supervisor smallint NUll
);

Insert into SalesPeople Values(1,'Bob','Bentley','bbb',100,4);
Insert into SalesPeople Values(2,'Lisa','Williams','lmw',300,4);
Insert into SalesPeople Values(3,'Clint','Sanchez','cls',100,1);
Insert into SalesPeople Values(4,'Scott','Bull','sjb',Null, Null);      


CREATE TABLE Studios (
        StudioID int,
        StudioName varchar (40) NULL ,
        Address varchar (60) NULL ,
        City varchar (25) NULL ,
        Region varchar (15) NULL ,
        PostalCode varchar (10) NULL ,
        Country varchar (20) NULL ,
        WebAddress varchar (40) NULL ,
        Contact varchar (50) NULL ,
        EMail varchar (40) NULL ,
        Phone varchar (16) NULL ,
        SalesID smallint NULL 
);

Insert Into Studios Values(1,'MakeTrax','3000 S St Rd 9','Anderson','IN','46012','USA','www.maketrax.com','Gardner Roberts','[email protected]','7651223000',3);
Insert Into Studios Values(2,'Lone Star Recording','PO Box 221','Davis','TX','76382','USA','www.lsrecords.com','Manuel Austin','[email protected]','8821993748',2);
Insert Into Studios Values(3,'Pacific Rim','681 PCH','Santa Theresa','CA','99320','USA','www.pacrim.org','Harry Lee','[email protected]','3811110033',2);


CREATE TABLE Titles (
        TitleID int ,
        ArtistID int NULL ,
        Title varchar (50) NULL ,
        StudioID int NULL ,
        UPC varchar (13) NULL ,
        Genre varchar (15) NULL 
);

Insert Into Titles Values(1,1,'Meet the Neurotics',1,'2727366627','alternative');
Insert Into Titles Values(3,15,'Smell the Glove',2,'1283772282','metal');
Insert Into Titles Values(4,10,'Time Flies',3,'1882344222','alternative');
Insert Into Titles Values(5,1,'Neurotic Sequel',1,'2828830202','alternative');
Insert Into Titles Values(6,5,'Sonatas',2,'3999320021','classical');
Insert Into Titles Values(7,2,'Louis at the Keys',3,'3838227111','jazz');


CREATE TABLE Tracks (
        TitleID int NOT NULL ,
        TrackNum smallint NOT NULL ,
        TrackTitle varchar (50) NULL ,
        LengthSeconds smallint NULL ,
        MP3 smallint NULL ,
        RealAud smallint NULL 
);

Insert Into Tracks Values(1,1,'Hottie',233,1,1);
Insert Into Tracks Values(1,2,'Goodtime March',293,1,1);
Insert Into Tracks Values(1,3,'TV Day',305,1,1);
Insert Into Tracks Values(1,4,'Call Me an Idiot',315,1,1);
Insert Into Tracks Values(1,5,'25',402,1,1);
Insert Into Tracks Values(1,6,'Palm',322,1,1);
Insert Into Tracks Values(1,7,'Front Door',192,1,1);
Insert Into Tracks Values(1,8,'Where''s the Rain',175,1,1);
Insert Into Tracks Values(3,1,'Fat Cheeks',352,1,1);
Insert Into Tracks Values(3,2,'Rocky and Natasha',283,1,1);
Insert Into Tracks Values(3,3,'Dweeb',273,1,1);
Insert Into Tracks Values(3,4,'Funky Town',252,1,1);
Insert Into Tracks Values(3,5,'Shoes',182,1,1);
Insert Into Tracks Values(3,6,'Time In - In Time',129,1,1);
Insert Into Tracks Values(3,7,'Wooden Man',314,0,0);
Insert Into Tracks Values(3,8,'UPS',97,0,0);
Insert Into Tracks Values(3,9,'Empty',182,0,0);
Insert Into Tracks Values(3,10,'Burrito',65,0,0);
Insert Into Tracks Values(4,1,'Bob''s Dream',185,1,1);
Insert Into Tracks Values(4,2,'My Wizard',233,1,1);
Insert Into Tracks Values(4,3,'Third''s Folly',352,1,1);
Insert Into Tracks Values(4,4,'Leather',185,1,1);
Insert Into Tracks Values(4,5,'Hot Cars Cool Nights',192,1,1);
Insert Into Tracks Values(4,6,'Music in You',204,1,1);
Insert Into Tracks Values(4,7,'Don''t Care About Time',221,1,1);
Insert Into Tracks Values(4,8,'Kiss',218,1,1);
Insert Into Tracks Values(4,9,'Pizza Box',183,1,1);
Insert Into Tracks Values(4,10,'Goodbye',240,1,1);
Insert Into Tracks Values(5,1,'Song 1',285,1,1);
Insert Into Tracks Values(5,2,'Song 2',272,1,1);
Insert Into Tracks Values(5,3,'Song 3',299,1,1);
Insert Into Tracks Values(5,4,'Song 4',201,1,1);
Insert Into Tracks Values(5,5,'Song 5',198,1,0);
Insert Into Tracks Values(5,6,'Song 6',254,1,0);
Insert Into Tracks Values(5,7,'Song 7',303,1,1);
Insert Into Tracks Values(5,8,'Song 8',230,1,0);
Insert Into Tracks Values(5,9,'Song 8 and 1/2',45,1,0);
Insert Into Tracks Values(6,1,'Violin Sonata No. 1 in D Major',511,1,1);
Insert Into Tracks Values(6,2,'Violin Sonata No. 2 in A Major',438,1,1);
Insert Into Tracks Values(6,3,'Violin Sonata No. 4 in E Minor',821,1,0);
Insert Into Tracks Values(6,4,'Piano Sonata No. 1',493,1,0);
Insert Into Tracks Values(6,5,'Clarinet Sonata in E Flat',399,1,0);
Insert Into Tracks Values(7,1,'I Don''t Know',201,1,0);
Insert Into Tracks Values(7,2,'What''s the Day',332,1,0);
Insert Into Tracks Values(7,3,'Sirius',287,1,0);
Insert Into Tracks Values(7,4,'Hamburger Blues',292,1,0);
Insert Into Tracks Values(7,5,'Road Trip',314,1,0);
Insert Into Tracks Values(7,6,'Meeting You',321,1,1);
Insert Into Tracks Values(7,7,'Improv 34',441,1,1);
Insert Into Tracks Values(7,8,'Hey',288,1,1);


CREATE TABLE XrefArtistsMembers (
        MemberID int NOT NULL ,
        ArtistID int NOT NULL ,
        RespParty smallint NOT NULL 
       );

Insert into XrefArtistsMembers Values(20,2,1);
Insert into XrefArtistsMembers Values(31,14,1);
Insert into XrefArtistsMembers Values(3,1,1);
Insert into XrefArtistsMembers Values(10,3,1);
Insert into XrefArtistsMembers Values(13,3,0);
Insert into XrefArtistsMembers Values(7,5,1);
Insert into XrefArtistsMembers Values(8,5,0);
Insert into XrefArtistsMembers Values(9,5,0);
Insert into XrefArtistsMembers Values(32,15,0);
Insert into XrefArtistsMembers Values(19,15,1);
Insert into XrefArtistsMembers Values(21,15,0);
Insert into XrefArtistsMembers Values(34,17,1);
Insert into XrefArtistsMembers Values(29,17,0);
Insert into XrefArtistsMembers Values(15,10,1);
Insert into XrefArtistsMembers Values(35,10,0);
Insert into XrefArtistsMembers Values(14,10,0);
Insert into XrefArtistsMembers Values(33,16,1);
Insert into XrefArtistsMembers Values(26,16,0);
Insert into XrefArtistsMembers Values(18,18,1);
Insert into XrefArtistsMembers Values(28,18,0);
Insert into XrefArtistsMembers Values(22,18,0);
Insert into XrefArtistsMembers Values(30,11,1);
Insert into XrefArtistsMembers Values(36,11,0);

show tables;

In: Computer Science

Using C++ programming. Thank you. Money class has the following member variables and functions. -member variable...

Using C++ programming. Thank you.

Money class has the following member variables and functions.
-member variable : dollar, cent
-member function : setMoney(int dollar, int cent), printMoney(), operator overloading(+)

Program the Money class so that the following function can be performed.

int main(){
Money a, b, c;
A.setMoney(10, 60);
B.setMoney(20, 70;
(a+b).printMoney();
c = a + b;
c.printMoney();
}

In: Computer Science

using text edit html Create a Web page that makes a list of your favorite movies...

using text edit html

Create a Web page that makes a list of your favorite movies and a list of your favorite actors. Make one list ordered (numbered) and one list unordered (bulleted). Title your Web page - John Doe's Movies Page but use your own name (this information goes in the title tag). Also include a paragraph describing one of your favorite movies and another paragraph describing one of your favorite actors. Include two heading levels - h1 and h2 somewhere on the page.

In: Computer Science

MAKE node class outside of stack class class Stack{    private:        class node{   ...

MAKE node class outside of stack class

class Stack{
   private:
       class node{
           public:
               node *next;
               int data;
               node(int d,node *n = NULL){
                   data = d;
                   next = n;
               }
       };
       node *start;
      
   public:
       Stack();
       Stack(const Stack& original);
       ~Stack();
      bool isEmpty() const ;
       int top() const;
      int pop() ;
       void push(int);
};

Stack::Stack(){
   start = NULL;
}

Stack::Stack(const Stack& original){
   if (original.isEmpty()) {
       start = NULL;
   } else {
       node* p = original.start; // points to current node on other
       node* tmp = new node(p->data); // make a copy of the first node
       start = tmp;
       node* tail = tmp; // points to last node of this list
       while (p->next != NULL) {
           p = p->next;
           tmp = new node(p->data);
           tail->next = tmp;
           tail = tmp;
       }
   }
}

Stack::~Stack(){
   node * curr = start;
   node *next;
   while(curr!=NULL){
       next = curr->next;
       delete curr;
       curr = next;
   }
}

bool Stack::isEmpty() const{
   if(start==NULL)
       return 1;
   return 0;
}

int Stack::top() const{
   if(isEmpty())
       throw "Stack is Empty";  
   return (start->data);
  
}

void Stack::push(int e){
   node *p = new node(e);
   if(isEmpty()){
       start = p;
   }else{
       p->next = start;
       start = p;
   }
  
}

int Stack::pop() {
   if(isEmpty())
       throw "Stack is Empty";
   else
   {
       node *p = start;
       start = start->next;
       int d = p->data;
       delete p;
       return d;
   }
}

/* A TEST PROGRAM */

#include<iostream>
using namespace std;

class Stack{
   private:
       class node{
           public:
               node *next;
               int data;
               node(int d,node *n = NULL){
                   data = d;
                   next = n;
               }
       };
       node *start;
      
   public:
       Stack();
       Stack(const Stack& original);
       ~Stack();
      bool isEmpty() const ;
       int top() const;
      int pop() ;
       void push(int);
};

Stack::Stack(){
   start = NULL;
}

Stack::Stack(const Stack& original){
   if (original.isEmpty()) {
       start = NULL;
   } else {
       node* p = original.start; // points to current node on other
       node* tmp = new node(p->data); // make a copy of the first node
       start = tmp;
       node* tail = tmp; // points to last node of this list
       while (p->next != NULL) {
           p = p->next;
           tmp = new node(p->data);
           tail->next = tmp;
           tail = tmp;
       }
   }
}

Stack::~Stack(){
   node * curr = start;
   node *next;
   while(curr!=NULL){
       next = curr->next;
       delete curr;
       curr = next;
   }
}

bool Stack::isEmpty() const{
   if(start==NULL)
       return 1;
   return 0;
}

int Stack::top() const{
   if(isEmpty())
       throw "Stack is Empty";  
   return (start->data);
  
}

void Stack::push(int e){
   node *p = new node(e);
   if(isEmpty()){
       start = p;
   }else{
       p->next = start;
       start = p;
   }
  
}

int Stack::pop() {
   if(isEmpty())
       throw "Stack is Empty";
   else
   {
       node *p = start;
       start = start->next;
       int d = p->data;
       delete p;
       return d;
   }
}

In: Computer Science

Math V3.0 Modify the previous version of this program again so it displays a menu allowing...

Math V3.0

Modify the previous version of this program again so it displays a menu allowing the user to select addition, subtraction, multiplication, or division problem. The final selection on the menu should let the user quit the program. After the user has finished the math problem, the program should display the menu again. This process is repeated until the user chooses to quit the program. If a user selected an item not on the menu, display an error message and display the menu again.

Note: Start with your code from the previous chapter! For this assignment, you are extending your previous project by allowing for subtraction, multiplication, and division, as well as addition. This can be a bit tricky (hence this is worth two assignments), so be careful. Here is a basic outline of what your program should look like:

  1. Declare your variables, including the correct answer
  2. Display the menu and prompt the user for their choice
  3. Make sure it is a valid choice
  4. For each possible choice:
    1. Figure out the two operands appropriately
    2. Determine and store the correct answer
    3. Display the problem (formatted nicely!)
  5. Assuming they didn't hit 5 to exit, prompt for the answer
  6. Provide feedback on the user's answer
  7. Repeat the loop as necessary

All generated numbers must be random. For addition and subtraction, the range of numbers must be between 50 and 500, like before. For multiplication, limit the numbers to be in the ranges 1-100 and 1-9. For division, generate the denominator in the range of 1-9. The numerator must be a multiple of the denominator (so there are no remainders for division!), no more than 50 times larger. You might have to think about this!

The output should look like this -- user inputs are in bold blue type:

Math Menu
------------------------------
1. Addition problem
2. Subtraction problem
3. Multiplication problem
4. Division problem
5. Quit this program
------------------------------
Enter your choice (1-5): 4

66 / 6 = 11

Congratulations! That's right.

Math Menu
------------------------------
1. Addition problem
2. Subtraction problem
3. Multiplication problem
4. Division problem
5. Quit this program
------------------------------
Enter your choice (1-5): 2

473 - 216 = 241

Sorry! That's incorrect.

Math Menu
------------------------------
1. Addition problem
2. Subtraction problem
3. Multiplication problem
4. Division problem
5. Quit this program
------------------------------
Enter your choice (1-5): 5
Thank you for using Math.

In: Computer Science

Temperature Converter Modify the previous version of this program so that it uses a loop to...

Temperature Converter

Modify the previous version of this program so that it uses a loop to display a range of temperature conversions for either Fahrenheit to Celsius or Celsius to Fahrenheit.

Note: You can start with the code from the previous version, then modify it slightly after it prompts the user for the direction to convert. It will then ask the user for a starting temperature and ending temperature. Assuming they entered the lower number first (if not, tell them and end the program), loop through the range provided, incrementing by 1 for each iteration of the loop, and generate the appropriate table.

The output should look like this -- user inputs are in bold blue type:
Temperature Conversion Table
Enter c (or C) to convert Fahrenheit to Celsius
   or f (or F) to convert Celsius to Fahrenheit: F
Enter the starting temperature: 30
Enter the ending temperature: 42

Celsius  Fahrenheit
    30        86.0
    31        87.8
    32        89.6
    33        91.4
    34        93.2
    35        95.0
    36        96.8
    37        98.6
    38       100.4
    39       102.2
    40       104.0
    41       105.8
    42       107.6

Running the program again:
Temperature Conversion Table
Enter c (or C) to convert Fahrenheit to Celsius
   or f (or F) to convert Celsius to Fahrenheit: c
Enter the starting temperature: -4
Enter the ending temperature: 4

Fahrenheit  Celsius
    -4       -20.0
    -3       -19.4
    -2       -18.9
    -1       -18.3
     0       -17.8
     1       -17.2
     2       -16.7
     3       -16.1
     4       -15.6

In: Computer Science

This program needs to be in Java Exercise on Single Dimensional Arrays Declare an array reference...

This program needs to be in Java


Exercise on Single Dimensional Arrays

  1. Declare an array reference variable arrayInt for an array of integers. Create the array of size 100, and assign it to arrayInt. (2 points)
  2. Write a method to populate the array with Random numbers between 1 to 25. Signature of the method is: populateArray( int[] ) which returns nothing. Call this method from main with arrayInt--> populateArray(arrayInt). (2 points)
  3. Write a method to print an array. Signature of the method is: printArray( int[] ) which returns nothing. Print maximum of ten(10) numbers on a line (see sample output below). Call this method from main with arrayInt--> printArray(arrayInt). Hint: Use the modulus operator. Any number n % 10 will return a value 0-9. (3 points)
  4. Write a method that finds the average of the array elements. Signature of the method is: findAverage( int[] ) which returns the averageto the calling program.Call this method from main with arrayInt--> findAverage(arrayInt).  (3 points)

SAMPLE OUTPUT:

1   12 20  11  10  15  17   5  20   8  
23 6 4 20 23 15 15 24 4 19
3 10 15 12 8 5 23 24 2 25
2 19 13 3 7 22 17 8 15 9
22 17 3 5 5 20 24 19 21 13
9 1 16 5 16 8 24 11 7 1
19 16 14 11 23 22 23 25 18 3
16 3 10 3 17 15 3 17 15 17
22 16 16 7 15 7 10 22 10 1
21 20 18 4 11 24 24 2 19 12
The average is: 12.51

In: Computer Science

Using Java, Complete LinkedListSet: package Homework3; public class LinkedListSet <T> extends LinkedListCollection <T> { LinkedListSet() {...

Using Java, Complete LinkedListSet:

package Homework3;
public class LinkedListSet <T> extends LinkedListCollection <T> {
LinkedListSet() {
}
public boolean add(T element) {
// Code here
return true;
}
}

Homework3 class:

public class Homework3 {
public static void main(String[] args) {
ArrayCollection ac1 = new ArrayCollection(); // Calling Default
Constructor
ArrayCollection ac2 = new ArrayCollection(2); // Calling overloaded
constructor
ArraySet as1 = new ArraySet();
ac2.add("Apple");
ac2.add("Orange");
ac2.add("Lemon"); // This can't be added into ac2 as collection is full
System.out.println(ac2.remove("Apple")); // This should return true
System.out.println(ac2);
ac2.enlarge(10);
ac2.add("Watermelon");
System.out.println("Equals: " + ac1.equals(ac2));
as1.add("Avocado");
as1.add("Avocado"); // This will not be added, since the
collection is "set"
}
}

In: Computer Science

what is C++? what is embedded computer?

what is C++?

what is embedded computer?

In: Computer Science