Questions
Java language Exercise #2: Design a Lotto class with one array instance variable to hold three...

Java language

Exercise #2:
Design a Lotto class with one array instance variable to hold three random integer values (from 1 to 9). Include a constructor that randomly populates the array for a lotto object. Also, include a method in the class to return the array.
Use this class in the driver class (LottoTest.java) to simulate a simple lotto game in which the user chooses a number between 3 and 27. The user runs the lotto up to 5 times ( by creating an object of Lotto class each time and with that three random integer values will be stored in objects’s array instance variable) and each time the sum of lotto numbers (sum of three random integers values) is calculated. If the number chosen by the user matches the sum, the user wins and the game ends. If the number does not match the sum within five rolls, the computer wins.


Exercise #3:
Write a Java class that implements a static method – SortNumbers(int… numbers) with variable number of arguments. The method should be called with different numbers of parameters and does arrange the numbers in descending order. Call the method within main method of the driver classand display the results.

In: Computer Science

using C++ 23. Savings Account Balance Write a program that calculates the balance of a savings...

using C++

23. Savings Account Balance
Write a program that calculates the balance of a savings account at the end of a three-
month period. It should ask the user for the starting balance and the annual interest
rate. A loop should then iterate once for every month in the period, performing the
following steps:
A) Ask the user for the total amount deposited into the account during that month
and add it to the balance. Do not accept negative numbers.
B) Ask the user for the total amount withdrawn from the account during that
month and subtract it from the balance. Do not accept negative numbers or
numbers greater than the balance after the deposits for the month have been
added in.
C) Calculate the interest for that month. The monthly interest rate is the annual
interest rate divided by 12. Multiply the monthly interest rate by the average of
that month’s starting and ending balance to get the interest amount for the
month. This amount should be added to the balance.
After the last iteration, the program should display a report that includes the following
information:
• starting balance at the beginning of the three-month period
• total deposits made during the three months
• total withdrawals made during the three months
• total interest posted to the account during the three months
• final balance

test case:

Test Case1:

Welcome to Your Bank!
What is your starting Balance? $100
What is the annual interest rate?. Please enter whole value. For example 6 for 6% :6

Month #1
Current Balance: $100.00
Please enter total amount of deposits: $2000
Please enter total amount of withdrawals: $200
New Balance: $1905.00

Month #2
Current Balance: $1905.00
Please enter total amount of deposits: $3000
Please enter total amount of withdrawals: $2000
New Balance: $2917.03

Month #3
Current Balance: $2917.03
Please enter total amount of deposits: $4000
Please enter total amount of withdrawals: $2000
New Balance: $4936.61

Start Balance:         $100.00
Total Deposits:        $9000.00
Total Withdrawals:     $4200.00
Total Interest Earned: $36.61
Final Balance:         $4936.61

In: Computer Science

Convert the following 32-bit IEEE floating point numbers to decimal: 0100 1100 1110 0110 1111 1000...

Convert the following 32-bit IEEE floating point numbers to decimal:

0100 1100 1110 0110 1111 1000 0000 0000
1011 0101 1110 0110 1010 0110 0000 0000

Determine whether or not the following pairs are equivalent by constructing truth tables:

[(wx'+y')(w'y+z)] and [(wx'z+y'z)]
[(wz'+xy)] and [(wxz'+xy+x'z')]

Using DeMorgan’s Law and Boolean algebra, convert the following expressions into simplest form:

(a'd)'
(w+y')'
((bd)(a + c'))'
((wy'+z)+(xz)')'

Draw the circuit that implements each of the following equations:

AB'+(C'+AD')+D
XY'+WZ+Y'
(AD'+BC+C'D)'
((W'X)'+(Y'+Z))'

In: Computer Science

In your own words, discuss the steps to improving customer experience.

In your own words, discuss the steps to improving customer experience.

In: Computer Science

I need to take the code i already have and change it to have at least...

I need to take the code i already have and change it to have at least one function in it. it has to include one function and one loop. I already have the loop but cant figure out how to add a function. I thought i could create a funciton to call to the totalCost but not sure how to do it. Help please.

#include
#include


//main function
int main(void)
{
   char userName [20];
   char yesOrNo [10];
   float cookieCost=0;
   float totalCost=0;
   float cookiePrice;       //declerations
   int cookieAmount;
   int cookieChoice;
  
   printf("Welcome to Candy Land Cafe!\n Please tell me your name.\n");
   scanf("%s", &userName);
   while(1)
   {
       printf("%s, what type of cookie would you like?\n", userName);
   printf("1 for Sugar Cookie - $0.25\n2 for Chocolate Chip - $0.35\n3 for Peanut Butter - $0.35\n");

   //input cookie choice
   scanf("%d", &cookieChoice);
  
   if(cookieChoice == 1){
       //user selected sugar cookie
       printf("You selected a Sugar Cookie. How many cookies would you like?\n");
       scanf("%d", &cookieAmount); //input
       cookiePrice = 0.25;   //set cookie price
   }
   else if (cookieChoice == 2)
   {   //user picked chocolate cookie
       printf("You selected a Chocolate Chip Cookie. How many would you like?\n");
       scanf("%d", &cookieAmount); //input
       cookiePrice = 0.35;   //set cookie price
   }
   else if (cookieChoice == 3)
   {   //user picked peanut cookie
       printf("You selected a Peanut Butter Cookie. How many would you like?\n");
       scanf("%d", &cookieAmount); //input
       cookiePrice = 0.35;           //set cookie price
   }

   else
   {
       //did not make valid choice
       printf("Invalid Choice, try again...\n");
       continue;
   }
  
   //calculate cost of cookies
   cookieCost= cookieAmount * cookiePrice;
  
   //add to total cost
   totalCost= totalCost + cookieCost;
  
   //cost of current cookie request
   printf("%s, your cost is $%.2f.\n", userName, cookieCost);
  
   //ask for more cookies
   printf("Would you like to order another cookie type?\n");
   scanf("%s", yesOrNo);
  
   if(strcmp(yesOrNo, "no")==0)   //if no, skip to total cost and end
   {
       printf("%s, your total cost is %.2f\n", userName, totalCost);
       break;   //end
   }
}

//dispaly to user at end "Thanks"
printf("Thanks for ordering from Candy Land Cafe!\n");


system ("pause");   //hold window open
return 0;       //success
  
}       //end main

In: Computer Science

Write a Bottle class. The Bottle will have one private int that represents the countable value...

Write a Bottle class. The Bottle will have one private int that represents the countable value in the Bottle. Please use one of these names: cookies, marbles, M&Ms, pennies, nickels, dimes or pebbles. The class has these 14 methods: read()(please use a while loop to prompt for an acceptable value), set(int), set(Bottle), get(), (returns the value stored in Bottle), add(Bottle), subtract(Bottle), multiply(Bottle), divide(Bottle), add(int), subtract(int), multiply(int), divide(int), equals(Bottle), and toString()(toString() method will be given in class). All add, subtract, multiply and divide methods return a Bottle. This means the demo code b2 = b3.add(b1) brings into the add method a Bottle b1 which is added to b3. Bottle b3 is the this Bottle. The returned bottle is a new bottle containing the sum of b1 and b3. The value of b3 (the this bottle) is not changed. Your Bottle class must guarantee bottles always have a positive value and never exceed a maximum number chosen by you. These numbers are declared as constants of the class. Use the names MIN and MAX. The read() method should guarantee a value that does not violate the MIN or MAX value. Use a while loop in the read method to prompt for a new value if necessary. Each method with a parameter must be examined to determine if the upper or lower bound could be violated. In the case of the add method with a Bottle parameter your code must test for violating the maximum value. It is impossible for this add method to violate the minimum value of zero. The method subtract with a Bottle parameter must test for a violation of the minimum zero value but should not test for exceeding the maximum value. In the case of a parameter that is an integer, all methods must be examined to guarantee a value that does not violate the MIN or MAX values. Consider each method carefully and test only the conditions that could be violated. (2 point) Further in the semester we will use a runtime exception class to guarantee these invariants. public String toString(){return “” + this.pennies;}

I also have a demo to go with this one...

import java.util.Scanner; // test driver for the Bottle class public class BottleDemo3 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int x; Bottle bottle1 = new Bottle(); Bottle bottle2 = new Bottle(); Bottle bottle3 = new Bottle(); Bottle bottle4 = new Bottle(); Bottle bottle5 = new Bottle(); System.out.println("please enter a number for bottle1:"); bottle1.read(); System.out.println("Bottle1 is this value " + bottle1 + "."); System.out.println("Please enter a number for bottle2:"); bottle2.read(); bottle3 = bottle2.add(bottle1); System.out.println("The sum of bottle2 and bottle1 is: " + bottle3 + "."); bottle4 = bottle3.divide(2); System.out.println("The 2 bottle average is: " + bottle4 + "."); System.out.print("Subtracting bottle1 from bottle2 is: " ); bottle3 = bottle2.subtract(bottle1); System.out.println( bottle3); bottle3 = bottle2.divide(bottle1); System.out.println("Dividing bottle2 with bottle1 is: " + bottle3 + "."); if (bottle1.equals(bottle2)) { System.out.println("Bottle1 and bottle2 are equal."); } else { System.out.println("Bottle1 and bottle2 are not equal."); } System.out.println("Bottle4 is now given the value of 10 with the set() method."); bottle4.set(10); System.out.println("The value of bottle4 is " + bottle4 + "."); System.out.println("Bottle4 is now multipled with bottle1. The value is placed in " + "bottle5."); bottle5 = bottle1.multiply(bottle4); System.out.println("The value of bottle5 is " + bottle5 + "."); System.out.println("Enter an integer to add to the value bottle1 has."); System.out.println("The sum will be put in bottle3."); x = scan.nextInt(); bottle3 = bottle1.add(x); System.out.println("Adding your number " + x + " to bottle1 gives a new Bottle with " + bottle3 + " in it."); System.out.print("Adding the number " + bottle2 + " which is the number" + " in bottle2 to the\nnumber in "); bottle2 = bottle1.add(bottle2); System.out.println("bottle1 which is " + bottle1 +" gives " + bottle2 + "."); bottle2.set(bottle2.get()); } }

In: Computer Science

<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>All Pets Veterinary Hospital</title> <style> body { font-family: arial,...

<!DOCTYPE html>


<html lang="en">


<head>
<meta charset="utf-8">
<title>All Pets Veterinary Hospital</title>

<style>
body {
font-family: arial, sans-serif;
font-size: 100%;
}
/* outer container */
  
#wrapper {
width: 960px;
margin: 50px auto;
padding: 0px;
background-color: rgb(255, 255, 255);
/* white */
border: 1px solid #000;
/* black */
}
  
header h1 {
text-align: center;
}
  
nav {
text-align: center;
background: rgb(175, 196, 206);
}
  
address figure {
text-align: center;
}


</style>
</head>

<body>

<div id="wrapper">
<!-- outer container -->

<header>
<h1>
All Pets Veterinary Hospital
<br>
<img src="images/logo.jpg" alt="All Pets Veterinary Hospital logo">
</h1>

<p>
<strong>All Pets Veterinary Hospital</strong> has been a leader in specialty veterinary care since 1990, fulfilling the need for specialty healthcare and emergency services for animals in San Diego County and Southern California.
</p>

<blockquote>
No matter how little money and how few possessions you own, having a dog makes you rich.
<br> -- Louis Sabin
</blockquote>
</header>

<nav>
<a href="#">Home</a> &nbsp; | &nbsp;
<a href="#">Services</a> &nbsp; | &nbsp;
<a href="#">Staff</a> &nbsp; | &nbsp;
<a href="#">Contact</a>
</nav>

<section>
<h2>About Us</h2>
<figure>
<img src="images/photo_about_us.jpg" alt="Photo of staff and dog">
</figure>
<p>
All Pets Veterinary Specialty Hospital is proud to provide the highest quality of specialty care to pets, and the best customer service to owners in the San Diego community. We have state-of-the-art facilities, with some of the most advanced equipment for pets found anywhere in the country. Simply put, we are committed to being leaders in providing the best specialty care for your pets.
</p>
</section>

<section>
<h2>Comprehensive Services</h2>
<figure>
<img src="images/photo_comprehensive_services.jpg" alt="Photo of Dog being examined">
</figure>
<p>
Our hospital utilizes the latest equipment, including MRI, CAT scan, radiation therapy, digital radiography, a state-of-the-art intensive care unit, ultra-modern surgical suites, endoscopy, ultrasound, and much more to provide comprehensive specialty care for pets of all ages. Furthermore, our staff of doctors, technicians and client service representatives has exceptional training, motivation, and compassion for the pets we treat.
</p>
</section>

<section>
<h2>Compassionate Care</h2>
<figure>
<img src="images/photo_compassionate_care.jpg" alt="Photo of staff and dog">
</figure>
<p>
In summary, as part of our mission to offer high-quality specialty care for pets in the San Diego area, our hospitals boast a level of sophistication that can only be found in the most advanced human medical facilities. We strive for exceptional client service and compassionate care for patients. Since most of us have pets of our own, we understand the strong bond that our clients have with their pets, and realize that they are part of the family.
</p>
</section>

<aside>
<h2>Testimonials</h2>

<p>
<q>Since I adopted my dogs they both have had significant health issues. In search of a vet that we like we tried several vet offices in San Diego. I was really impressed by this facility. Not only they have very reasonable prices, but they love animals, and they care a lot about all their patients. Unlike some other offices we have been to, they never prescribe any unnecessary treatments and they are always very clear about what treatment options we have for our budget. If something serious is going on they follow up with us after the visit, and just truly care about well being of our animals.</q>
<br> - J. Smith
</p>

<p>
<q>Recently one of my dogs passed away. Me and my husband are so heartbroken. The staff has been so compassionate and caring through this difficult time. We could not ask for a better doctors for our fur-babies! I highly recommend this veterinary hospital office for anyone looking for a new or better veterinary clinic for their pets. They treat and take good care of my dogs like they are one of their own furry family members!</q>
<br> - A. Lopez
</p>

</aside>

<footer>
<h2>Contact us</h2>
<p>
If you're looking for high-quality specialty care for your pets, call us at <strong>(858) 777-7700</strong> or you can schedule an appointment for your pet online.
</p>

<address>
We are located at:<br>
10400 Sorrento Valley Road<br>
San Diego, CA 92121<br>
<strong>(858) 777-7700</strong>
  
<figure>
<img src="images/icons_social.jpg" alt="social icons">
</figure>
  
</address>
</footer>

</div>
<!-- end outer container -->

</body>

</html>

1.Add the needed CSS property, using the selectors of your choice so that the text is not so close to the edge of the outer border of the main “wrapper”. You want to adjust the space inside the element.

2.Add the needed CSS property, using the selector(s) of your choice so that the <section> <aside> and <footer>

elements are not so close to each other from the top/bottom. You want to adjust the space outside the element.

3.Add the needed CSS property, using the selector(s) of your choice to create a visual separator effect along the bottom of the <section> and <aside>

elements – do not use an element. This is done using the border property! Use any style of your choice

4. Add the needed CSS property or properties, using the selector(s) of your choice to apply at least a shadow to the three photos. You may add additional or alternate effect(s) if desired, as long as the three photos have a style around them. You must use either box-shadow or border-radius but you can use a combination, and can also include the border property. These three images will all have the same style so use the appropriate selector

5.Add the needed CSS property/properties using the selector of your choice to apply rounded corners to the social icon image

6.Add the needed CSS property/properties using the selectors of your choice to add a background image to the two <h2>

elements. You will need to use a text property to move the text away from the edge of the

element so it does not overlap with the background image.

In: Computer Science

Using one Unix command, how to go to my home directory using tilde, ~. Using one...

  1. Using one Unix command, how to go to my home directory using tilde, ~.
  2. Using one Unix command, how to go to your home directory using tilde, ~.
  3. Make sure you are in your home directory.
    Using one Unix command, how to go to your hw4 directory inside your hw directory, inside your it244directory using a relative pathname.
  4. Using one Unix command, how to go to my home directory using an absolute pathname.
  5. Using one Unix command, how to go to the it244_files directory inside the course_files directory, inside my home directory, using an absolute pathname.
  6. Using one Unix command, how to go to my home directory using a relative pathname using ...
  7. Using one Unix command, go to your home directory.
    Once you are there go to your it244 directory using a relative pathname.
  8. How would you make sure you are in your it244 directory.
    Using touch create a file named test.txt.
    Go to your hw4 directory.
    Using .. stay in your hw4 directory but list the contents of your it244 directory.
  9. How to make sure you are in your hw4 directory.
  10. Stay in this directory and copy the test.txt file from your it244 directory to your hw4 directory using a relative pathname.
  11. Using one Unix command and multiple instances of.., go to your home directory.
    Once you are there, show me that you are in the right directory.
    Using one Unix command, copy the test.txt file from your it244/hw/hw4 directory to your home directory.
    List the contents of the directory

In: Computer Science

1. Represent following floating-point numbers in IEEE single-precision (32-bit) format: a. -0.1875, b. 0.46875 2. What...

1. Represent following floating-point numbers in IEEE single-precision (32-bit) format: a. -0.1875, b. 0.46875

2. What is the decimal value of the following IEEE single-precision (32-bit) floating-point numbers (which are shown in hexadecimal)? a. 3F400000, b. BE000000

In: Computer Science

Assuming integers are represented as 32-bit words and negative numbers are represented using the 2's complimentary...

Assuming integers are represented as 32-bit words and negative numbers are represented using the 2's complimentary method convert the following decimal numbers to hexadecimal numbers (show your work). a. -1314, b. 2020

In: Computer Science

Assuming integers are represented as 16-bit words and negative numbers are represented using the 2's complementary...

Assuming integers are represented as 16-bit words and negative numbers are represented using the 2's complementary method, convert the following hexadecimal numbers to decimal numbers a. 0xCAFE, b. 0x4DAD, c. 0xFACE

In: Computer Science

Research and describe 1. User Interface (UI) best practices * Describe UI best practices and principles....

Research and describe

1. User Interface (UI) best practices * Describe UI best practices and principles. Provide examples of a few principles that you come across. Provide examples of good and poor UI design.post must be at least 200 words

In: Computer Science

R language create file Ass2.txt "("Macauley, Culkin" "Antoine, Doinel" "Ace, Ventura" "Tommy, DeVito" "Oda Mae, Brown"...

R language

create file Ass2.txt

"("Macauley, Culkin" "Antoine, Doinel" "Ace, Ventura" "Tommy, DeVito" "Oda Mae, Brown" "John, Malkovich" "Sandy, Olsson" "Raymond, Babbitt" "Jack, Sparrow" "Melanie, Daniels" "Stanley, Kowalski" "Darth, Vader" "Jack, Torrance" "Aurora, Greenway" "Sam, Spade" "Hans, Beckert" "Max, Rockatansky" "Tony, Manero")".

a. Import the data into a vector named name and create an email address for each student as follows. The general format of an email address is username (at) domain. For each student, username is the name of the student in lowercase, with a period separating the first name and the last name if a last name is provided; and domain is IloveR.edu. Name the vector that contains the email addresses as email.

b. Export the data in email to a plain-text file named email.txt in the following format: • Use the column names as the header line.

• There should be no quotes or row names. • Use the comma as a separator.

In: Computer Science

Using Python Define a Student class. A Student class needs to have two attributes, the student_name...

Using Python

Define a Student class. A Student class needs to have two attributes, the student_name and strudent_grade . It also has three methods as follows: set_grade(grade) that sets the grade of the student. get_grade returns the grade of the student. print_student_info that print the name and grade of student in a formatted string.

In the math_utils.py file define a function called average_grade(roster) . This method accepts as input a list of Student Objects and returns the average of the current roster.

In the app.py file, create a main function, to create a roster of 10 students, print the list of students, and print the average score of the current roster. You can either populate the student roster interactively (i.e. by using the input method to prompt the user from the console) or hard-code the student information in your code.

The app.py file must use the Student class, and the average_grade method you defined the mymodules module.

In: Computer Science

Before you begin your program: Create a text file in your project folder with 20 "quirky...

Before you begin your program: Create a text file in your project folder with 20 "quirky sayings"/fortunes (the only requirement is that they be appropriate for display in class), In your program you will Create a list by reading those 20 fortunes from your file Ask the user how many fortunes he/she wants to see. store the value in a variable Inside of a loop (loop as many times as the user asked) select a random answer from your list of fortunes wait for the user to press the enter key (the easy way is to use the Scanner's nextLine method) Note that it is quite possible that you will see some fortunes more than once while not seeing some at all.

In: Computer Science