Java

Search for question

Questions & Answers

The U.S. Census Bureau lists the U.S. population as 205 million in 1970, 227 million in 1980,249 million in 1990 and 282 in 2000. a. Fit a cubic polynomial from 1970 to 2000. b. Predict the population in 2020. c. Plot the graph.


Question 1: Given that you don't have any other data structures (array or linked list) for queue implementation: Discuss how to implement queue data structure using stack. 2, How many stacks are needed to implement a queue? 3. Given the Stack Interface and the Linked Stack classes, write a Java code to create queue using stack. Test your code by creating a queue Number that takes N numbers to enqueue and then dequeue and print them the numbers on the screen. 4. What is the complexity of queue implementation using stack. 5. Is it possible to implement the stack data structure using queue? Justify youranswer.


Topic: SQL with programming language Today is lab work 7. This lab depends on the skills we have learned on the previous labs. Goal: Connect our MySQL server with a programming language and perform several operations using the programming language. Prerequisite: • Find the username of your MySQL user. • Find the password of your MySQL user. When you have installed the MySQL Workbench you have created the username and password. On your MySQL Workbench go to MANAGEMENT -> Users and Privileges. You will see the users. If you have forgot the password, create a new user and password by clicking on the Add Account.


import java.sql.*; public class DDTest4 ( public static void main(String[] args) throws Exception( String urijdba:mysql://localhost:3306/CarShop"; String user - "root" string pass="root"; Connection con DriverManager.getConnection( user,pass): Statement stcon.createStatement (); PreparedStatement psticon.preparestatement("select from product where pid=?"); PreparedStatement pst2 con.preparestatement ( "insert into product (pid, name, company,price, quantity) values (?,?,?.?.?)"); psti. 1, 2): Resultset rs psti. while (rs.next()) { System.out.println (rs.getString("name")+""+rs.getDouble ("price")); ) pst2.setInt (1,3): (2,"LS350"): pst2.setstring (3, "Lexus"); (4,15600.0); pst2 pst2. pst2.setInt (5,7): int rows pst2.executeUpdate(): pst2.setInt (1,4): pst2.setString (2,"1525"); pst2.setString (3,"BMW"): pst2.setDouble (4,18200.0): pst2.setInt (5,6): rows pst2. pst1.setInt (1, 4); Es psti.executeQuery(): while (rs.next()) { System.out.printin (rs.getString("name") + "+rs.getString ("company")+""+rs.getDouble ("price")); } pst1.setInt (1, 1); rs psti.executeQuery(): while (rs.next()) { System.out.println (rs. 1 1 1 pstl.setInt (1, 3): rs psti.executeQuery(): while (rs.next()) { System.out.println(rs.getString ("name")+""+rs.getDouble ("price")); "name") "+rs.getDouble ("price")); st.close(): psti.close(); pst2.close(); zows - st. ("delete from product where pid>2"); rows - st.executeUpdate("update product set price 4500.0 where pid-2") ;


Print the name of the item from the file "price.txt" which has a price more than 2.0 [5 marks]


4) Execute the flips on the game board.You can do this by calling the draw lmage() method in a loop.


1) Undo/Redo Button Using a Stack Addcode to the start method to set up the initial board position (look it up online).


13. Write a code that randomly selects a card and prints it on the screen. { Create a string array with "Clubs", "Diamonds", "Hearts", "Spades"} and { "2", "3", "4", "5", "6", ",", "8", "9", "10", "Jack", "Queen", "King", and "Ace"} and write code to randomly select 5 cards from them.


No Question Found forJava

we will make sure available to you as soon as possible.